gemseo / utils / study_analyses

Hide inherited members

xls_study_parser module

Excel file parser for the study analyses.

class gemseo.utils.study_analyses.xls_study_parser.XLSStudyParser(xls_study_path, has_scenario=True)[source]

Bases: object

A study specification based on an Excel file.

The Excel file shall contain one sheet per discipline:

  • the name of the sheet shall have the discipline name,

  • the sheet shall define the input names of the discipline as a vertical succession of cells starting with "Inputs":

    Inputs

    Inputs

    input_name_1

    input_name_N

  • the sheet shall define the output names of the discipline as a vertical succession of cells starting with "Outputs":

Outputs

Outputs

output_name_1

output_name_N

  • the empty lines of the series Inputs and Outputs are ignored,

  • the sheet may contain other data, but these will not be taken into account.

If has_scenario is True, the Excel file shall contain one sheet per scenario with a name starting by Scenario. Distributed formulations shall contain one sheet for the main scenario and one sheet per sub-scenario.

A scenario sheet shall have the following columns:

Scenario1

Design variables

Objective function

Constraints

Disciplines

Formulation

Options

Options values

in1

out1

out2

Disc1

MDF

tolerance

0.1

Disc2

main_mda_name

MDAJacobi

These columns must satisfy some constraints:

  • all of them are mandatory, even if empty for the constraints,

  • their order does not matter,

  • one and only one formulation must be declared,

  • at least one objective must be provided,

  • at least one design variable must be provided,

  • all the objective functions and constraints must be outputs of a discipline, not necessarily the one of the current sheet,

  • all the design variables must be inputs of a discipline, not necessarily the one of the current sheet.

The columns Options and Options values are used to pass the formulation options. Note that for string type Option values, the value can be written with or without the "" characters.

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, …, n, level formulations).

Parameters:
  • xls_study_path (str) – The path to the Excel file describing the study.

  • has_scenario (bool) –

    Whether the Excel file has a scenario sheet.

    By default it is set to True.

Raises:
  • IOError – If the Excel file cannot be opened.

  • ValueError – If no scenario has been found in Excel file while the study is an MDO one.

CONSTRAINTS: Final[str] = 'Constraints'
DESIGN_VARIABLES: Final[str] = 'Design variables'
DISCIPLINE: Final[str] = 'Discipline'
DISCIPLINES: Final[str] = 'Disciplines'
FORMULATION: Final[str] = 'Formulation'
OBJECTIVE_FUNCTION: Final[str] = 'Objective function'
OPTIONS: Final[str] = 'Options'
OPTION_VALUES: Final[str] = 'Options values'
SCENARIO_PREFIX: Final[str] = 'Scenario'
disciplines: dict[str, MDODiscipline]

The non-executable disciplines.

inputs: set[str]

The names of the input variables.

outputs: set[str]

The names of the output variables.

scenarios: dict[str, dict[str, str | list[str]]]

The descriptions of the scenarios.

worksheets: dict[str, DataFrame]

The worksheets of the Excel file.

xls_study_path: str

The path to the Excel file.