Base Dynamic System¶
This module contains the abstract definition of a dynamic system. It has the definition of BaseDynamicSystem, that should be extended, implementing its abstract methods.
Example
Creating a simulator:
class DynamicSystem(BaseDynamicSystem):
def get_output(self, input):
outs = {}
for model in self._models:
outs[model] = model.get_output()
def state_transition(self):
for model in self._models:
model.state_transition()
Add a model to the dynamic system:
Model(dynamic_system)
Add a link between models:
path = Path(from_model, to_model, Value(1), 'path name')
dynamic_system.add(path)
# or
from_model.add(to_model, Value(1), 'path name')
-
class
gsf.dynamic_system.core.base_dynamic_sytem.
BaseDynamicSystem
¶ Bases:
object
Abstract dynamic system
It contains a collection of models and paths. Dynamic systems execute the state transition and compute the output of the models.
-
_models
¶ Models of the dynamic system
- Type
DynamicSystemModels
-
_paths
¶ Paths of the dynamic system.
- Type
DynamicSystemPaths
-
_event_bus
¶ Event bus of the module.
- Type
EventBus
-
abstract
get_output
() → DynamicSystemOutput¶ Gets the output of the dynamic system.
-
remove
()¶ Removes a model of the dynamic system.
- Parameters
model (BaseModel) – Model to be removed.
-
show
(file_name: str = 'dynamic_system')¶ Shows a graph of the dynamic system
- Parameters
file_name (str) – Name of the file to be generated.
-
abstract
state_transition
(*args, **kwargs) → DynamicSystemOutput¶ Executes the state transition of the dynamic system.
- Parameters
*args –
**kwargs –
-