DiamondLightSource / tickit

Event-based hardware simulation framework
Apache License 2.0
7 stars 0 forks source link

Ticks not completing if there is no delta for a system simulation #179

Closed abbiemery closed 1 year ago

abbiemery commented 1 year ago

If you have a simulation that uses nested components, or system simulation components, then there are situations where the tick never finishes. If a component preceeding the system component updates, but produces no change in inpur for the system component then the system component and anything downstream should trim off the to update stack and the tick should end. However currently the system component is getting trimmed, but the componenents downstream are not. There remains incomplete updates in the to update stack and the tick never ends.

This can be replicated by the following:

- type: tickit.devices.source.Source
  name: source
  inputs: {}
  value: 10.0

- type: examples.adapters.system_simulation_adapter_config.NestedAmplifierWithAdapter
  name: nested-amp
  inputs:
    input_1:
      component: source
      port: value
  components:
    - type: examples.devices.amplifier.Amplifier
      name: amp
      inputs:
        initial_signal:
          component: external
          port: input_1
      initial_amplification: 2
  expose:
    output_1:
      component: amp
      port: amplified_signal

- type: tickit.devices.sink.Sink
  name: external_sink
  inputs:
    sink_1:
      component: nested-amp
      port: output_1

if you add a callback to the source call_at=SimTime(time + 1000000000)

abbiemery commented 1 year ago

Regardless of the types of components this trimming fails beyond the direct dependent of the first skipped component.

abbiemery commented 1 year ago

Fixed by #180