Trigger Model¶
Trigger models handle the time synchronization behaviour of devices:
Within Hermes, the SimulatedDrop
models the highest level of physical layer simulation.
By default, the first sample of a drop is also considered the first sample of the contained simulation / sensing frames.
However, when multiple devices and links interfer with each other, their individual frame structures might be completely asynchronous.
This modeling can be adressed by shared trigger models, all devices sharing a trigger model will
be frame-synchronous within the simulated drop, however, different trigger models introduce unique time-offsets within the simulation drop.
The currently implemented trigger models are
Trigger Model |
Description |
---|---|
Random triggering within a given time interval. |
|
Static triggering at a given sample offset. |
|
Static triggering at a given time offset. |
|
Static triggering with no offset. This is the default. |
They can be configured by assigning the same TriggerModel
instance to the trigger_model
property of multiple simulated devices:
# Create a new simulation featuring two sets of two linked, synchronized devices
simulation = Simulation()
# Create devices
device_A_Tx = simulation.new_device(carrier_frequency=3.7e9)
device_A_Rx = simulation.new_device(carrier_frequency=3.7e9)
device_B_Tx = simulation.new_device(carrier_frequency=3.9e9)
device_B_Rx = simulation.new_device(carrier_frequency=3.9e9)
# Specify trigger models
trigger_model_A = TriggerModel()
device_A_Tx.trigger_model = trigger_model_A
device_A_Rx.trigger_model = trigger_model_A
trigger_model_B = TriggerModel()
device_B_Tx.trigger_model = trigger_model_B
device_B_Rx.trigger_model = trigger_model_B
Of course, the abstract TriggerModel in the above snippet must be replaced by the desired implementation from the list above.
- class TriggerModel[source]¶
Bases:
ABC
,RandomNode
Base class for all trigger models.
- add_device(device)[source]¶
Add a new device to be controlled by this trigger.
- Parameters:
device (SimulatedDevice) – The device to be controlled by this trigger.
- Return type:
- abstract realize(rng=None)[source]¶
Realize a triggering of all controlled devices.
- Parameters:
rng (np.random.Generator, optional) – Random number generator used to realize this trigger model. If not specified, the object’s internal generator will be queried.
- Return type:
Returns: Realization of the trigger model.
- remove_device(device)[source]¶
Remove a device from being controlled by this trigger.
- Parameters:
device (SimulatedDevice) – The device to be removed.
- Return type:
- property devices: Set[SimulatedDevice]¶
Set of devices controlled by this trigger.