SimulationSetup

Qualified name: api.simulation.simulation_setup.SimulationSetup

class api.simulation.simulation_setup.SimulationSetup(proj)[source]

Bases: ABC

Entry point for simulation API

Parameters:

proj (Project) – The project instance

Methods

create_data_table_setup

Creates a data table and returns a corresponding DataTableSetup object

create_load_case_container_setup

Creates a load case container and returns a corresponding LoadCaseContainerSetup object

create_study_setup

Creates a study and returns a corresponding StudiesSetup object

get_available_data_table_types_names

Gets the names of the installed data table types

get_available_data_tables_names

Gets the names of existing data tables

get_available_load_case_containers_names

Gets the names of existing load case containers

get_available_studies_names

Gets the names of existing studies

get_data_table_setup

Creates and returns a DataTableSetup for an already existing data table, if plugins are installed it automatically finds the correct data table setup object

get_load_case_container_setup

Creates a LoadCaseContainerSetup for an already existing load case container

get_study_setup

Creates and returns a StudiesSetup for an already existing study

remove_data_table_setup

Removes a data table

remove_load_case_container_setup

Removes a load case container

remove_study_setup

Removes a study

abstract create_data_table_setup(data_table_type_name: str = 'Transient data table') DataTableSetup[source]

Creates a data table and returns a corresponding DataTableSetup object

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> # print(simulation_setup.get_available_data_table_types_names()) # Optionally Check which data table types are available
>>> data_table_setup = simulation_setup.create_data_table_setup(data_table_type_name='Transient data table')
Parameters:

data_table_type_name (: str, default='Transient data table') – The name of the type of data table to add, if no name is given then a ‘Transient data table’ is created by default

Returns:

A DataTableSetup object for the created data table

Return type:

DataTableSetup

Raises:

NameNotFoundError – Raised if no data table type with the given name exists

abstract create_load_case_container_setup() LoadCaseContainerSetup[source]

Creates a load case container and returns a corresponding LoadCaseContainerSetup object

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> load_case_container_setup = simulation_setup.create_load_case_container_setup() \
...                                             .set_name(name='load_case_container_name')
Returns:

A LoadCaseContainerSetup object for the created load case container

Return type:

LoadCaseContainerSetup

abstract create_study_setup() StudiesSetup[source]

Creates a study and returns a corresponding StudiesSetup object

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> study_setup = simulation_setup.create_study_setup()
Returns:

A StudiesSetup object for the created study

Return type:

StudiesSetup

abstract get_available_data_table_types_names() List[str][source]

Gets the names of the installed data table types

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> simulation_setup.get_available_data_table_types_names() # Will return all names of available data table types
... 
[...'Transient data table'...]
Returns:

Names of installed data table type names

Return type:

list of strings

abstract get_available_data_tables_names() List[str][source]

Gets the names of existing data tables

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> simulation_setup \
... .create_data_table_setup(data_table_type_name='Transient data table') \
... .set_name('first_data_table')
<more.transient_data_table.scripting_api.transient_data_table_setup.TransientDataTableSetup object at 0x...>
>>> simulation_setup \
... .create_data_table_setup(data_table_type_name='Transient data table') \
... .set_name('second_data_table')
<more.transient_data_table.scripting_api.transient_data_table_setup.TransientDataTableSetup object at 0x...>
>>> simulation_setup.get_available_data_tables_names()
['first_data_table', 'second_data_table']
Returns:

Names of existing data tables

Return type:

list of strings

abstract get_available_load_case_containers_names() List[str][source]

Gets the names of existing load case containers

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> lcc_setup_1 = simulation_setup.create_load_case_container_setup().set_name(name='first_lcc')
>>> lcc_setup_2 = simulation_setup.create_load_case_container_setup().set_name(name='second_lcc')
>>> simulation_setup.get_available_load_case_containers_names()
['Empty', 'first_lcc', 'second_lcc']
Returns:

Names of existing load case containers

Return type:

list of strings

abstract get_available_studies_names() List[str][source]

Gets the names of existing studies

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> studies_setup_1 = simulation_setup \
... .create_study_setup() \
... .set_name('first_study')
>>> studies_setup_2 = simulation_setup \
... .create_study_setup() \
... .set_name('second_study')
>>> simulation_setup.get_available_studies_names()
['first_study', 'second_study']
Returns:

Names of existing studies

Return type:

list of strings

abstract get_data_table_setup(name: str) DataTableSetup[source]

Creates and returns a DataTableSetup for an already existing data table, if plugins are installed it automatically finds the correct data table setup object

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> data_table_setup = simulation_setup.get_data_table_setup(name='data_table_name')
Parameters:

name (str) – The name of the existing data table for which to return a DataTableSetup

Returns:

A DataTableSetup object for the found data table

Return type:

DataTableSetup

Raises:
  • NotImplementedError – Raised if no DataTableSetup was implemented for the given data table, may happen when using plugins

  • NameNotFoundError – Raised if no data table with the given name was found

abstract get_load_case_container_setup(name: str) LoadCaseContainerSetup[source]

Creates a LoadCaseContainerSetup for an already existing load case container

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> load_case_container_setup = simulation_setup.get_load_case_container_setup(name='load_case_container_name')
Parameters:

name (str) – The name of the existing load case container for which to return a LoadCaseContainerSetup

Returns:

A LoadCaseContainerSetup object for the found load case container

Return type:

LoadCaseContainerSetup

Raises:

NameNotFoundError – Raised if no load case container with the given name was found

abstract get_study_setup(name: str) StudiesSetup[source]

Creates and returns a StudiesSetup for an already existing study

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> study_setup = simulation_setup.get_study_setup(name='study_name')
Parameters:

name (str) – The name of the existing study for which to return a StudiesSetup

Returns:

A StudiesSetup object for the found study

Return type:

StudiesSetup

Raises:

NameNotFoundError – Raised if no study with the given name was found

abstract remove_data_table_setup(name: str) SimulationSetup[source]

Removes a data table

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> data_table_setup = simulation_setup.create_data_table_setup().set_name(name='data_table_name') # Creates a transient data table so that there is something to remove
>>> simulation_setup.remove_data_table_setup(name='data_table_name') # Assumes this data table exists
<more...>
Parameters:

name (str) – The name of the data table to remove

Returns:

self

Return type:

SimulationSetup

Raises:

NameNotFoundError – Raised if no data table with the given name exists

abstract remove_load_case_container_setup(name: str) SimulationSetup[source]

Removes a load case container

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> load_case_container_setup = simulation_setup.create_load_case_container_setup().set_name(name='load_case_container_name') # Creates a load case container so there is something to remove
>>> simulation_setup.remove_load_case_container_setup(name='load_case_container_name')
<more...>
Parameters:

name (str) – The name of the load case container to remove

Returns:

self

Return type:

SimulationSetup

Raises:

NameNotFoundError – Raised if no load case container with the given name exists

abstract remove_study_setup(name: str) SimulationSetup[source]

Removes a study

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> simulation_setup = api.create_simulation_setup()
>>> study_setup = simulation_setup.create_study_setup().set_name(name='study_name')
>>> simulation_setup.remove_study_setup(name='study_name')
<more...>
Parameters:

name (str) – The name of the study to remove

Returns:

self

Return type:

SimulationSetup

Raises:

NameNotFoundError – Raised if no study with the given name exists