symupy.runtime.logic package¶
Submodules¶
symupy.runtime.logic.base module¶
This module contains a base class definition representing a single generic state
symupy.runtime.logic.publisher module¶
Publisher¶
This module dedicates a generic object to generate a publisher pattern implementation responsible of specific methods.
- class symupy.runtime.logic.publisher.Publisher(channels=('default',))[source]¶
Bases:
symupy.abstractions.subject.AbsSubject
This generic class model implements a general publisher pattern to broadcast information towards different subscribers. Subscribers are intented to be objects such as vehicles or other objects that should be aware of the publisher.
In particular this creates a subject that can notify to a specific channel where subscribers are registered.
Example
Create a DataQuery for 2 type of channels,
automated
andregular
and perform a subscription>>> channels = ('auto','regular') >>> p = Publisher(channels) >>> s = Subscriber(p,'auto') # Registers a s into p
- attach(observer, channel: str, callback=None)[source]¶
Attach a new observer to a specific channel,, one can specify a method of the class to be called.
- Parameters
channel (str) – channel name
observer (observer) – observer object
callback (callable) – method to be executed when publisher notifies.
- property channels¶
- detach(observer, channel: str)[source]¶
Detach observer from the subject
- Parameters
channel (str) – channel name
observer (observer) – observer object
callback (callable) – method to be executed when publisher notifies.
symupy.runtime.logic.runtime module¶
This module describes classes and objects to perform a runtime of a single scenario
- class symupy.runtime.logic.runtime.RuntimeDevice[source]¶
Bases:
object
This class defines the runtime device describing a series of cyclic states required to be run
- Returns
Runtime Device for controlling states of the simulation runtime
- Return type
symupy.runtime.logic.sorted_frozen_set module¶
This is a class describing a sorted frozen set. This is a collection implementation for a set of ordered elements that establish specific protocols for iteration, information access, element identification.
- class symupy.runtime.logic.sorted_frozen_set.SortedFrozenSet(items=None)[source]¶
Bases:
collections.abc.Sequence
,collections.abc.Set
This is a collection that provides a set of properties to create a sorted frozen set.
In particular
- Parameters
Sequence (Sequence) – Inherits from the Sequence collection object.
Set (Set) – Inherits from the Set collection object.
symupy.runtime.logic.states module¶
This module defines the basic states required to execute and launch a simulation.
The states are defined as:
Compliance: This state is defined to check availability of files and candidates.
Connect: This state is defined to process
Initialize: This state perform initialization tasks. In example, loading the file scenarios into the simulator. Declaring initial conditions for the platoon, etc.
Preroutine: Tasks to be done before the querying information from the simulator
Query: Tasks of parsing data and querying information from the simulator
Control: Perform decision tasks for the platoon
Push: Push updated information to the simulator for platoon vehicles
Postroutine: Performs tasks after the information has been pushed.
- class symupy.runtime.logic.states.Compliance[source]¶
Bases:
symupy.runtime.logic.base.State
The state which declares an status to check file compliance .
- class symupy.runtime.logic.states.Connect[source]¶
Bases:
symupy.runtime.logic.base.State
The state which declares the creation of a connection with the simulator
- class symupy.runtime.logic.states.Control[source]¶
Bases:
symupy.runtime.logic.base.State
The state which computes the control decision
- class symupy.runtime.logic.states.Initialize[source]¶
Bases:
symupy.runtime.logic.base.State
The state which initializes values for the scenario simulation
- class symupy.runtime.logic.states.PostRoutine[source]¶
Bases:
symupy.runtime.logic.base.State
The state which logs information or compute step indicators
- class symupy.runtime.logic.states.PreRoutine[source]¶
Bases:
symupy.runtime.logic.base.State
The state which performs task previous to the interaction with the simulator
- class symupy.runtime.logic.states.Push[source]¶
Bases:
symupy.runtime.logic.base.State
The state which pushes data back to the simulator
- class symupy.runtime.logic.states.Query[source]¶
Bases:
symupy.runtime.logic.base.State
The state which retrieves information from the simulator
- class symupy.runtime.logic.states.Terminate[source]¶
Bases:
symupy.runtime.logic.base.State
The state which declares the end of a simulation
symupy.runtime.logic.subscriber module¶
Subscriber¶
This module dedicates a generic object to generate an observer pattern implementation responsible of subscribing to a publisher
- class symupy.runtime.logic.subscriber.Subscriber(publisher, channel='default')[source]¶
Bases:
symupy.abstractions.observer.AbsObserver
This general dataquery model implements a general publisher pattern to broadcast information towards different subscribers. Subscribers are intented to be objects such as vehicles, front/rear gap coordinators.
This creates an subject that can notify to a specific channel where subscribers are registered or
Example
Create a DataQuery for 2 type of channels,
automated
andregular
vehicles:>>> channels = ('auto','regular') >>> query = DataQuery(channels)