CoupledDEVS¶
-
class
DEVS.
CoupledDEVS
(name=None)[source]¶ Abstract base class for all coupled-DEVS descriptive classes.
-
__init__
(name=None)[source]¶ Constructor.
Parameters: name – the name of the coupled model, can be None for an automatically generated name
-
addSubModel
(model, location=None)[source]¶ Adds a specified model to the current coupled model as its child. This is the function that must be used to make distributed simulation possible.
Parameters: - model – the model to be added as a child
- location – the location at which the child must run
Returns: model – the model that was created as a child
Changed in version 2.1.3: model can no longer be a string, this was previously a lot more efficient in partial distribution, though this functionality was removed together with the partial distribution functionality.
-
connectPorts
(p1, p2, z=None)[source]¶ Connects two ports together. The coupling is to begin at p1 and to end at p2.
Parameters: - p1 – the port at the start of the new connection
- p2 – the port at the end of the new connection
- z – the translation function for the events either input-to-input, output-to-input or output-to-output.
-
disconnectPorts
(p1, p2)[source]¶ Disconnect two ports
Note
If these ports are connected multiple times, only one of them will be removed.
Parameters: - p1 – the port at the start of the connection
- p2 – the port at the end of the connection
-
finalize
(name, model_counter, model_ids, locations, select_hierarchy)[source]¶ Finalize the model hierarchy by doing all pre-simulation configuration
Note
Parameters model_ids and locations are updated by reference.
Parameters: - name – the name of the hierarchy above
- model_counter – the model ID counter
- model_ids – a list with all model_ids and their model
- locations – dictionary of locations and where every model runs
- select_hierarchy – hierarchy to perform selections in Classic DEVS
Returns: int – the new model ID counter
-
flattenConnections
()[source]¶ Flattens the pickling graph, by removing backreference from the ports.
-
getModelLoad
(lst)[source]¶ Fetch the number of atomic models at this model
Parameters: lst – list containing all locations and their current load Returns: number of atomic models in this subtree, including non-local ones
-
removeSubModel
(model)[source]¶ Remove a specified model from the current coupled model, only callable while in a simulation.
Parameters: model – the model to remove as a child
-
select
(imm_children)[source]¶ DEFAULT select function, only used when using Classic DEVS simulation
Parameters: imm_children – list of all children that want to transition Returns: child – a single child that is allowed to transition
-