SimulationSetup¶
Qualified name: api.simulation.simulation_setup.SimulationSetup
- class api.simulation.simulation_setup.SimulationSetup(proj)[source]¶
Bases:
ABCEntry point for simulation API
- Parameters:
proj (Project) – The project instance
Methods
Creates a data table and returns a corresponding
DataTableSetupobjectCreates a load case container and returns a corresponding
LoadCaseContainerSetupobjectCreates a study and returns a corresponding
StudiesSetupobjectGets the names of the installed data table types
Gets the names of existing data tables, optionally returns only names of data tables that have the type specified by type_name
Gets the names of existing load case containers
Gets the names of existing studies
Creates and returns a
DataTableSetupfor an already existing data table, if plugins are installed it automatically finds the correct data table setup objectCreates a
LoadCaseContainerSetupfor an already existing load case containerCreates and returns a
StudiesSetupfor an already existing studyRemoves a data table
Removes a load case container
Removes a study
- abstractmethod create_data_table_setup(data_table_type_name: str = 'Transient data table') DataTableSetup[source]¶
Creates a data table and returns a corresponding
DataTableSetupobjectExample
>>> 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
DataTableSetupobject for the created data table- Return type:
- Raises:
NameNotFoundError – Raised if no data table type with the given name exists
- abstractmethod create_load_case_container_setup() LoadCaseContainerSetup[source]¶
Creates a load case container and returns a corresponding
LoadCaseContainerSetupobjectExample
>>> 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
LoadCaseContainerSetupobject for the created load case container- Return type:
- abstractmethod create_study_setup() StudiesSetup[source]¶
Creates a study and returns a corresponding
StudiesSetupobjectExample
>>> from more.api import ApiGateway >>> api = ApiGateway(proj=proj) >>> simulation_setup = api.create_simulation_setup() >>> study_setup = simulation_setup.create_study_setup()
- Returns:
A
StudiesSetupobject for the created study- Return type:
- abstractmethod 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
- abstractmethod get_available_data_tables_names(type_name: str | None = None) List[str][source]¶
Gets the names of existing data tables, optionally returns only names of data tables that have the type specified by type_name
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'] >>> simulation_setup.get_available_data_tables_names(type_name="Transient data table") ['first_data_table', 'second_data_table']
- Parameters:
type_name (Optional[str]) – Only return names of data tables that match the type given by type_name
- Returns:
Names of existing data tables
- Return type:
list of strings
- abstractmethod 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
- abstractmethod 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
- abstractmethod get_data_table_setup(name: str) DataTableSetup[source]¶
Creates and returns a
DataTableSetupfor an already existing data table, if plugins are installed it automatically finds the correct data table setup objectExample
>>> 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
DataTableSetupobject for the found data table- Return type:
- Raises:
NotImplementedError – Raised if no
DataTableSetupwas implemented for the given data table, may happen when using pluginsNameNotFoundError – Raised if no data table with the given name was found
- abstractmethod get_load_case_container_setup(name: str) LoadCaseContainerSetup[source]¶
Creates a
LoadCaseContainerSetupfor an already existing load case containerExample
>>> 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
LoadCaseContainerSetupobject for the found load case container- Return type:
- Raises:
NameNotFoundError – Raised if no load case container with the given name was found
- abstractmethod get_study_setup(name: str) StudiesSetup[source]¶
Creates and returns a
StudiesSetupfor an already existing studyExample
>>> 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
StudiesSetupobject for the found study- Return type:
- Raises:
NameNotFoundError – Raised if no study with the given name was found
- abstractmethod 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:
- Raises:
NameNotFoundError – Raised if no data table with the given name exists
- abstractmethod 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:
- Raises:
NameNotFoundError – Raised if no load case container with the given name exists
- abstractmethod 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:
- Raises:
NameNotFoundError – Raised if no study with the given name exists