Basics¶
-
class
rtctools.simulation.simulation_problem.
SimulationProblem
(**kwargs)[source]¶ Bases:
rtctools.data.storage.DataStoreAccessor
Implements the BMI Interface.
Base class for all Simulation problems. Loads the Modelica Model.
Variables: modelica_library_folders – Folders containing any referenced Modelica libraries. Default is an empty list. -
get_start_time
()[source]¶ Return start time of experiment.
Returns: The start time of the experiment.
-
get_var
(name)[source]¶ Return a numpy array from FMU.
Parameters: name – Variable name. Returns: The value of the variable.
-
get_var_count
()[source]¶ Return the number of variables in the model.
Returns: The number of variables in the model.
-
get_var_name
(i)[source]¶ Returns the name of a variable.
Parameters: i – Index in ordered dictionary returned by method get_variables. Returns: The name of the variable.
-
get_var_type
(name)[source]¶ Return type, compatible with numpy.
Parameters: name – String variable name. Returns: The numpy-compatible type of the variable. Raises: KeyError
-
get_variables
()[source]¶ Return all variables (both internal and user defined)
Returns: An ordered dictionary of all variables supported by the model.
-
initialize
(config_file=None)[source]¶ Initialize state vector with default values
Parameters: config_file – Path to an initialization file.
-
-
rtctools.util.
run_simulation_problem
(simulation_problem_class, base_folder='..', log_level=20, **kwargs)[source]¶ Sets up and runs a simulation problem.
Parameters: - simulation_problem_class – Simulation problem class to solve.
- base_folder – Folder within which subfolders “input”, “output”, and “model” exist, containing input and output data, and the model, respectively.
- log_level – The log level to use.
Returns: SimulationProblem
instance.