Comment on page
🔢

# 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 https://en.wikipedia.org/wiki/Z-transform#Transfer_function
Parameters, Inputs, Outputs, and Data Types are all the same as for the continuous transfer function.

## 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 https://en.wikipedia.org/wiki/PID_controller, 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

## Pulse

A source block that emits a pulse wave as defined in https://en.wikipedia.org/wiki/Pulse_wave.
• 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.

## Random normal

Sample normally distributed random numbers with zero mean and unit variance:
$x \sim \mathcal{N}(0, 1)$
. All outputs are uncorrelated in time and across vector elements.
• Parameters
• Shape: The shape of the output signal (defaults to (), representing a scalar)
• Outputs
• Normally distributed random numbers

## 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.

## VideoSource

A source block that emits R,G,B color channels as matrices from a video file (.mp4). Since the output type is uint8 it can only be consumed by a Python Script, Object Detection, Image Segmentation or Predictor blocks.
• Parameters
• File name: the video file to use as source data. Must be a valid mp4 video at a fixed resolution and framerate.
• Outputs
• 3 x W x H matrix of uint8 values.
• Notes:
• For more information on how to use the R,G,B pixel data, refer to the ImageSource block (found under Agnostic Blocks).