gemseo / utils

study_analysis module¶

Generate a N2 and XDSM from an Excel description of the MDO problem¶

class gemseo.utils.study_analysis.StudyAnalysis(xls_study_path)[source]

Bases: object

Generate a N2 (equivalent to the Design Structure Matrix) diagram, showing the couplings between discipline and XDSM, (Extended Design Structure Matrix), showing the MDO process, from a Excel specification of the inputs, outputs, design variables, objectives and constraints.

The input excel files contains one sheet per discipline. The name of the sheet is the discipline name. The sheet has at least two columns, one for inputs and one for outputs, with the following format:

Inputs

Outputs

in1

out1

in2

out2

[Disc1]

Empty lines are ignored.

The scenarios (at least one, or multiple for distributed formulations) must appear in a Excel sheet name starting by “Scenario”.

The sheet has the following columns, with some constraints : All of them are mandatory, even if empty for the Constraints The order may be any 1 and only 1 formulation must be declared At least 1 objective must be provided, and 1 design variable

Design variables

Objective function

Constraints

Disciplines

Formulation

Options

Options values

in1

out1

out2

Disc1

MDF

tolerance

0.1

Disc2

[Scenario1]

All Objective functions and constraints must be outputs of a discipline, not necessarily the one of the current sheet. All Design variables must be inputs of a discipline, not necessarily the one of the current sheet.

The Options and Options values columns are used to pass the formulation options

To use multi level MDO formulations, create multiple scenarios, and add the name of the sub scenarios in the list of disciplines of the main (system) scenario.

An arbitrary number of levels can be generated this way (three, four levels etc formulations).

Initializes the study from the excel specification

Parameters

xls_study_path – path to the excel file describing the study

AVAILABLE_DISTRIBUTED_FORMULATIONS = ('BiLevel', 'BLISS98B')
generate_n2(file_path='n2.pdf', show_data_names=True, save=True, show=False, figsize=(15, 10))[source]

Generate a N2 plot for the disciplines list.

Parameters
• file_path (str) – File path of the figure.

• show_data_names (bool) – If true, the names of the coupling data is shown otherwise, circles are drawn, which size depend on the number of coupling names.

• save (bool) – If True, saved the figure to file_path.

• show (bool) – If True, shows the plot.

• figsize (tuple(float)) – Size of the figure.

generate_xdsm(output_dir, latex_output=False, open_browser=False)[source]

Creates an xdsm.json file from the current scenario.

Parameters
• output_dir – the directory where XDSM html files are generated

• latex_output – build .tex, .tikz and .pdf file

Returns

the MDOScenario, that contains the DesignSpace, the formulation, but the disciplines have only correct input and output grammars but no _run methods so that can’t be executed

class gemseo.utils.study_analysis.XLSStudyParser(xls_study_path)[source]

Bases: object

Parse the input excel files that describe the GEMSEO study.

The Excel file must contain one sheet per discipline. The name of the sheet is the discipline name. The sheet has at least two columns, one for inputs and one for outputs, with the following format:

Inputs

Outputs

Design variables

Objective function

Constraints

in1

out1

in1

out1

out2

in2

out2

Empty lines are ignored. All Objective functions and constraints must be outputs of a discipline, not necessarily the one of the current sheet All Design variables must be inputs of a discipline, not necessarily the one of the current sheet

Initializes the study from the excel specification

Parameters

xls_study_path – path to the excel file describing the study

CONSTRAINTS = 'Constraints'
DESIGN_VARIABLES = 'Design variables'
DISCIPLINE = 'Discipline'
DISCIPLINES = 'Disciplines'
FORMULATION = 'Formulation'
OBJECTIVE_FUNCTION = 'Objective function'
OPTIONS = 'Options'
OPTIONS_VALUES = 'Options values'
SCENARIO_PREFIX = 'Scenario'