Discrete Blocks

The following blocks are defined as having a discrete time_mode
More about time_modes. Discrete block do not have events associated with them.

Integrator (Discrete)

Same as continuous integrator, but applies a local forward Euler method for integration.
Parameters, Inputs, Outputs, and Data Types are all the same as for the continuous integrator.

Unit Delay (Discrete)

Holds and delays the input by one Discrete Step.

Transfer Function (Discrete)

Implements a discrete transfer function as described in
Parameters, Inputs, Outputs, and Data Types are all the same as for the continuous transfer function.

Zero Order Hold (Discrete)

Derivative (Discrete)

Computes the first-order approximation of the first derivative of the input signal with respect to time.
Similar to Derivative block, but uses less states to compute the derivative.

PID (Discrete)

Implements a simple PID controller defined in, but operates in discrete time.
  • Parameters
    • Kp: the proportional gain.
    • Ki: the integral gain.
    • Kd: the derivative gain.
  • Data Types
    • double

Filter (Discrete)

Implements a discrete filter similar to scipy.signal.lfilter.
  • Parameters
    • Filter Type: FIR or IIR
    • B coefficients
    • A coefficients (only applicable for IIR selection)
  • Data Types
    • double


A source block that emits a pulse wave as defined in
  • Parameters
    • Amplitude: the value of the pulse wave when the wave is high.
    • Pulse width: the fraction between 0 and 1 of the period that the pulse wave is high.
    • Period: the length of time between two sequential rising edges of the pulse wave.
    • Phase delay: an amount time by which the first rising edge is delayed after the simulation start time.
  • Outputs
    • pulse wave signal
  • Data Types
    • double
  • Events
    • This block produces periodic events triggering majors steps for each rising edge and each falling edge.

Discrete Initializer

Outputs True for first discrete step, then outputs False there after. Or, outputs False for first discrete step, then outputs True there after.
Practical for cases where it is necessary to have some signal fed initially by some initialization, but then after from else in the model.


A source block that emits R,G,B color channels as matrices from a video file (.mp4).
  • Parameters
    • File name: the video file to use as source data. Must be a valid mp4 video at a fixed resolution and framerate.
    • Normalize: When True, the R, G, B color values will be normalized to the range [0, 1]. When False, the values will be integers in the range [0, 255].
    • Width: The width in pixels of the video.
    • Height: The height in pixels of the video.
  • Notes:
    • While width and height are explicitly required and must match the actual file in use, these parameters are likely to be removed in a future update to Collimator, where we will detect the size from the source video.
    • For more information on how to use the R,G,B pixel data, refer to the ImageSource block (found under Agnostic Blocks).
    • The video source block will emit new frames at a rate of 1/fps where fps is the number of frames per second in the original video file. It is recommended to set the global discrete tick to match the expected framerate. For instance, if the video framerate is 25, then the global discrete tick should be 1/25 = 0.04