Event-based device simulation framework
Project description
An event-based multi-device simulation framework providing configuration and orchestration of complex multi-device simulations.
PyPI |
pip install tickit |
Source code |
|
Documentation |
|
Changelog |
https://github.com/dls-controls/tickit/blob/master/CHANGELOG.rst |
An example device which emits a random value between 0 and 255 whenever called and asks to be called again once the simulation has progressed by the callback_period:
class RandomTrampoline(ConfigurableDevice):
Inputs: TypedDict = TypedDict("Inputs", {})
Outputs: TypedDict = TypedDict("Outputs", {"output": int})
def __init__(self, callback_period: int = int(1e9)) -> None:
self.callback_period = SimTime(callback_period)
def update(self, time: SimTime, inputs: Inputs) -> DeviceUpdate[Outputs]:
output = randint(0, 255)
LOGGER.debug(
"Boing! (delta: {}, inputs: {}, output: {})".format(time, inputs, output)
)
return DeviceUpdate(
RandomTrampoline.Outputs(output=output),
SimTime(time + self.callback_period),
)
An example simulation defines a RemoteControlled device named tcp_contr and a Sink device named contr_sink. The observed output of tcp_contr is wired to the input input of contr_sink. Additionally, extenal control of tcp_contr is afforded by a RemoteControlledAdapter which is exposed extenally through a TCPServer:
- tickit.core.components.device_simulation.DeviceSimulation:
adapters:
- examples.devices.remote_controlled.RemoteControlledAdapter:
server:
tickit.adapters.servers.tcp.TcpServer:
format: "%b\r\n"
device:
examples.devices.remote_controlled.RemoteControlled: {}
inputs: {}
name: tcp_contr
- tickit.core.components.device_simulation.DeviceSimulation:
adapters: []
device:
tickit.devices.sink.Sink: {}
inputs:
input: tcp_contr:observed
name: contr_sink
See https://dls-controls.github.io/tickit for more detailed documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tickit-0.1.1rc2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de8e9d6580a6bdab2faad75ad3bda19ef554734afabd06422f7972c6e5dfc242 |
|
MD5 | 1edcdeba1a687be7c5803968d1d54418 |
|
BLAKE2b-256 | 8c56ff2d0b368a1ae6511eb0591efa1e3f4570195fff44310b90de9b24592b12 |