pySimBlocks.core.task¶
- class pySimBlocks.core.task.Task(sample_time: float, period_ticks: int, blocks: List[Block], global_output_order: List[Block])[source]¶
Bases:
objectA group of blocks sharing the same sample time.
Manages the scheduling and execution of output updates, state updates, and state commits for all blocks in the group.
Scheduling is tick-based: the task maintains an integer countdown reset to
period_ticks - 1after each activation. This avoids floating-point time comparisons and works correctly with both fixed and external clocks.- sample_time¶
Sampling period of this task in seconds.
- period_ticks¶
Number of base ticks between two activations.
- ticks_until_next¶
Countdown to the next activation.
- accumulated_dt¶
Accumulated time since the last activation.
- output_blocks¶
Blocks ordered for output computation, filtered from the global output order.
- state_blocks¶
Subset of output_blocks that carry internal state.
- should_run() bool[source]¶
Return True if the task is due to run at time t.
- Returns:
True if ticks_until_next is zero, indicating that the task should run at the current time step.