Skip to main content

Code CI Docs CI Test Coverage Latest PyPI version Apache License

An event-based multi-device simulation framework providing configuration and orchestration of complex multi-device simulations.

PyPI

pip install tickit

Source code

https://github.com/dls-controls/tickit

Documentation

https://dls-controls.github.io/tickit

Releases

https://github.com/dls-controls/tickit/releases

An example simulation consists of a simple counter and a sink. The counter increments up a given value and then passes this value to a sink.

A simulation is defined using a yaml file, in which the graphing of the required components is denoted. This file defines a Counter device named counter and a Sink device named counter_sink. The output _value of counter is wired to the input of counter_sink.

- type: examples.devices.counter.Counter
  name: counter
  inputs: {}
- type: tickit.devices.sink.Sink
  name: counter_sink
  inputs:
    input:
      component: counter
      port: _value

This file is executed to run the simulation.

python -m tickit all examples/configs/counter.yaml

The simulation will output logs depicting the incrementing of the counter:

DEBUG:examples.devices.counter:Counter initialized with value => 0
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:tickit.core.management.ticker:Doing tick @ 0
DEBUG:tickit.core.components.component:counter got Input(target='counter', time=0, changes=immutables.Map({}))
DEBUG:examples.devices.counter:Counter incremented to 1
DEBUG:tickit.core.management.schedulers.base:Scheduler got Output(source='counter', time=0, changes=immutables.Map({'value': 1}), call_at=1000000000)
DEBUG:tickit.core.management.schedulers.base:Scheduling counter for wakeup at 1000000000
DEBUG:tickit.core.components.component:counter_sink got Input(target='counter_sink', time=0, changes=immutables.Map({}))
DEBUG:tickit.devices.sink:Sunk {}
DEBUG:tickit.core.management.schedulers.base:Scheduler got Output(source='counter_sink', time=0, changes=immutables.Map({}), call_at=None)
DEBUG:tickit.core.management.ticker:Doing tick @ 1000000000
DEBUG:tickit.core.components.component:counter got Input(target='counter', time=1000000000, changes=immutables.Map({}))
DEBUG:examples.devices.counter:Counter incremented to 2
DEBUG:tickit.core.management.schedulers.base:Scheduler got Output(source='counter', time=1000000000, changes=immutables.Map({'value': 2}), call_at=2000000000)

The counting device is defined as below. It increments a given value and logs as it increments.

@dataclass
class Counter(ComponentConfig):
    """Simple counting device."""

    def __call__(self) -> Component:  # noqa: D102
        return DeviceComponent(
            name=self.name,
            device=CounterDevice(),
            )

class CounterDevice(Device):
    """A simple device which increments a value."""

    class Inputs(TypedDict):
        ...

    class Outputs(TypedDict):
        value: int

    def __init__(self, initial_value: int = 0, callback_period: int = int(1e9)) -> None:
        self._value = initial_value
        self.callback_period = SimTime(callback_period)
        LOGGER.debug(f"Counter initialized with value => {self._value}")

    def update(self, time: SimTime, inputs: Inputs) -> DeviceUpdate[Outputs]:
        self._value = self._value + 1
        LOGGER.debug(f"Counter incremented to {self._value}")
        return DeviceUpdate(
            CounterDevice.Outputs(value=self._value),
            SimTime(time + self.callback_period),
        )

See https://dls-controls.github.io/tickit for more detailed documentation.

Metadata

Release files for tickit 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tickit 0.4.3
File Size Uploaded
tickit-0.4.3.tar.gz 234.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tickit 0.4.3
File Interpreter ABI Platform
tickit-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 294.6 kB

Release files / tickit-0.4.3.tar.gz

Download URL tickit-0.4.3.tar.gz
Size 234.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9b449e84196ace9cf7f489de3ec782c38aae09124cb2c1d45feb62649fdcbc3a
BLAKE2b-256 checksum
How to use checksums
a358a6fbeccba6ad280c81a3746ed3442a7d10495f6c9f798eeccbcbd9bbbb3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / tickit-0.4.3-py3-none-any.whl

Download URL tickit-0.4.3-py3-none-any.whl
Size 59.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d87697f7020d89a4690a0975cad7ea175eed374eade757d61516db3ae4738b84
BLAKE2b-256 checksum
How to use checksums
9447075ef49be0bcce5fa75edc3a48c81140e1a18a5420948a9800824a053424
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page