Learn about basic Simulink block how to use it

Welcome to MAE Learning

Hello everyone, welcome to MAE Learning . In this article, we will explore some basic Simulink blocks.

These include Saturation, Unit Delay, Delay, and Data Type Conversion blocks.

Simulink Control Systems Engineering Learning
Simulink Block

Saturation Block

The Saturation block limits the input signal between a maximum and minimum value.

If the input is higher than the upper limit, the block outputs the upper limit.
If the input is lower than the lower limit, the block outputs the lower limit.
If the input is within the range, the block outputs the input as it is.

Examples

Limiting the throttle signal of an engine between 0% and 100%.
Restricting motor control voltage between -5 V and +5 V.

Simulink Block

Delay Block

The Delay block outputs the input after a given number of sample steps.

The delay length is defined using the Delay length parameter.
It is commonly used for modeling transport delay or buffering data.

Examples

Delaying an audio signal by 3 samples to create an echo effect.
Delaying a sensor reading in a control loop to model time lag.

Simulink Block

Unit Delay Block

The Unit Delay block holds the input value for one sample period before passing it to the output.

It is equivalent to the zโปยน operator in discrete-time systems.
Works with both scalar and vector signals.
Commonly used in feedback loops and iterative subsystems.

Examples

Storing the last speed value of a vehicle to calculate acceleration.
Holding the previous temperature reading in a thermal control system.

Simulink Block

Data Type Conversion Block

The Data Type Conversion block changes the input signal into another data type.

Supports conversion between integer, double, single, fixed-point, and Boolean.
The output matches the selected data type while keeping the value as close as possible.

Examples

Converting a floating-point sensor value into an integer for display.
Changing a Boolean fault flag into double for calculations.

โš ๏ธ Data Type Mismatch Error

Data type mismatch. ‘Output Port 1’ of ‘Unit Delay’ is uint8 but connected signal expects boolean.
Data type mismatch. ‘Add Block Input’ expects boolean but receives uint8.

This error occurs because different blocks are using incompatible data types.

โœ… Solution: Use a Data Type Conversion block to convert the signal into the required data type.

Fix Logic

Unit Delay (uint8) โ†’ Data Type Conversion โ†’ Boolean
Boolean โ†’ Add Block

Unit Delay vs Delay Block

Feature Unit Delay Block Delay Block
Delay Amount Fixed (1 sample period) User-defined (multiple / variable)
Main Use Discrete-time modeling (zโปยน) Arbitrary delays, buffers
Initial Condition User configurable User configurable / via port
Sample Time Explicit or inherited Explicit or inherited
Variable Delay No Yes
Supported Data Types Most (except int64, uint64) Most (supports variable delay)
Frame / Multichannel Yes Yes
Applications Control loops, digital filters Buffers, FIFO, transport delay

Summary: Unit Delay vs Delay Block

Unit Delay Block: Ideal for introducing a one-step discrete delay. Commonly used in digital control systems and shift registers. It represents the zโปยน operator in discrete-time systems.

Delay Block: More flexible and supports arbitrary delay lengths, including dynamic and variable delays. Suitable for modeling time lags, buffers, and complex delay behaviors.

Common Features: Both blocks allow initial condition configuration, support discrete sample time, and can be used in frame-based (multichannel) signal processing.