agentlib.models package
Package with available models for the agentlib
- agentlib.models.get_model_type(model_type) type [source]
Return and load the given module type
- Parameters:
str (model_type) – The string identifier to load the module.
- Return type:
module BaseModelType
Submodules
agentlib.models.fmu_model module
This module contains the FMUModel class.
- class agentlib.models.fmu_model.FmuModel(**kwargs)[source]
Bases:
Model
Class to wrap any FMU Model into the Model-Standard of the agentlib.
- do_step(*, t_start, t_sample=None)[source]
Performing one simulation step :param t_start: start time for integration :param t_sample: increment of solver integration
Returns:
- property extract_fmu
Get whether the fmu shall be extracted to a new directory or if the temp folder is used.
- initialize(**kwargs)[source]
Initializes FMU model
- Required kwargs:
t_start (float): Start time of simulation t_stop (float): Stop time of simulation
- set_input_values(names: List[str], values: List[float | int | bool])[source]
Sets input values in the model and in the FMU.
- set_parameter_values(names: List[str], values: List[float | int | bool])[source]
Sets parameter values in the model and in the FMU.
- property tolerance
Get the tolerance of FMU simulation
- pydantic model agentlib.models.fmu_model.FmuModelConfig[source]
Bases:
ModelConfig
The Config of FMUModels overwrite the default ModelConfig to redefine the system and add relevant fields like path and tolerance of the simulation.
- Config:
validate_assignment: bool = True
arbitrary_types_allowed: bool = True
extra: str = forbid
- Fields:
- Validators:
- field description: str = 'You forgot to document your model!'
- field dt: float | int = 1
- field extract_fmu: bool = False
- field inputs: ModelInputs = []
- Validated by:
- field log_fmu: bool = True
- field name: str | None = None
- Validated by:
- field only_config_variables: bool = True
If True, only the variables passed to this model by a simulator will be read and written at each simulation step (specified by dt).
- field outputs: ModelOutputs = []
- Validated by:
- field parameters: ModelParameters = []
- Validated by:
- field path: Path [Required]
- Constraints:
path_type = file
- Validated by:
- field sim_time: float = 0
- field states: ModelStates = []
- Validated by:
- field tolerance: float = 0.001
- field user_config: dict = None
The config given by the user to instantiate this class.Will be stored to enable a valid overwriting of the default config and to better restart modules.Is also useful to debug validators and the general BaseModuleConfig.
- field validate_variables: bool = True
If true, the validator of a variables value is called whenever a new value is set. Disabled by default for performance reasons.
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
agentlib.models.scipy_model module
This module contains the ScipyStateSpaceModel class.
- class agentlib.models.scipy_model.ScipyStateSpaceModel(**kwargs)[source]
Bases:
Model
This class holds a scipy StateSpace model. It uses scipy.signal.lti as a system and the odeint as integrator.
- pydantic model agentlib.models.scipy_model.ScipyStateSpaceModelConfig[source]
Bases:
ModelConfig
Customize config of Model.
- Config:
validate_assignment: bool = True
arbitrary_types_allowed: bool = True
extra: str = forbid
- Fields:
- Validators:
- field description: str = 'You forgot to document your model!'
- Validated by:
- field dt: float | int = 1
- Validated by:
- field inputs: ModelInputs = []
- Validated by:
- field name: str | None = None
- Validated by:
- field outputs: ModelOutputs = []
- Validated by:
- field parameters: ModelParameters = []
- Validated by:
- field sim_time: float = 0
- Validated by:
- field states: ModelStates = []
- Validated by:
- field system: dict | list | tuple | StateSpace [Required]
- Validated by:
- field user_config: dict = None
The config given by the user to instantiate this class.Will be stored to enable a valid overwriting of the default config and to better restart modules.Is also useful to debug validators and the general BaseModuleConfig.
- Validated by:
- field validate_variables: bool = True
If true, the validator of a variables value is called whenever a new value is set. Disabled by default for performance reasons.
- Validated by:
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.