Source blocks generate input signals for a Simulink model. They act as starting points for simulation.
| Source Block | Description |
|---|---|
| Constant | Generates a constant signal |
| Step | Produces a step change in signal |
| Ramp | Creates a linearly increasing signal |
| Signal Builder | Designs custom input signals |
| From Workspace | Imports data from MATLAB workspace |
| Sine Wave | Generates sinusoidal signals |
Example:
Step block:
Initial value = 0
Final value = 1
Step time = 5
Automotive Example:
A Step block can simulate a sudden change in accelerator pedal position during vehicle testing.
Sink blocks are used to collect or display output signals from a Simulink model.
| Sink Block | Description |
|---|---|
| Scope | Displays signals as graphs |
| Display | Shows numerical values |
| To Workspace | Exports data to MATLAB workspace |
| To File | Saves data to a file |
Example:
Use Scope block to visualize signal changes over time
Use To Workspace to store output data
Automotive Example:
Vehicle speed output can be sent to the MATLAB workspace for further analysis and visualization.
The Gain block multiplies the input signal by a constant value.
| Concept | Description |
|---|---|
| Operation | Multiplies input by a constant (Gain) |
| Formula | Output = Gain × Input |
| Usage | Signal scaling and unit conversion |
Example:
Gain = 3
Input = 2
Output = 6
Automotive Example:
The Gain block can be used to convert sensor voltage into physical units such as vehicle speed (km/h).
The Sum block performs addition or subtraction of input signals.
| Concept | Description |
|---|---|
| Operation | Adds or subtracts multiple input signals |
| Configuration | Uses + or − signs to define operations |
| Usage | Commonly used in control system calculations |
Example:
Error = Desired Speed - Actual Speed
Automotive Example:
The Sum block is used to calculate speed error in cruise control systems.
The Product block performs multiplication or division of input signals.
| Concept | Description |
|---|---|
| Operation | Multiplies or divides input signals |
| Configuration | Supports multiple inputs with × or ÷ operations |
| Usage | Used for mathematical computations in models |
Example:
Torque = Force × Radius
Automotive Example:
The Product block is used to calculate engine torque based on force and radius.
The Switch block selects one of two input signals based on a given condition.
| Concept | Description |
|---|---|
| Function | Chooses between two inputs |
| Condition | Based on control signal and threshold |
| Usage | Used for decision-making in models |
Example:
if control signal ≥ threshold
output = input1
else
output = input2
Automotive Example:
The Switch block can be used to select between manual and automatic control modes in a vehicle.
The Multiport Switch block selects one input signal from multiple inputs based on an index signal.
| Concept | Description |
|---|---|
| Function | Selects one input from many inputs |
| Control | Uses an index signal to choose input |
| Usage | Used for multi-condition selection |
Example:
Index = 2 → Output = Input2
Index = 3 → Output = Input3
Automotive Example:
The Multiport Switch block is used to select drive modes such as Eco, Normal, or Sport.
The Lookup Table block maps input values to output values using predefined calibration data.
| Feature | Description |
|---|---|
| Mapping | Relates input values to output values |
| Interpolation | Estimates values between known data points |
| Extrapolation | Estimates values outside the defined range |
| Usage | Used for nonlinear system modeling |
Example:
Input: RPM, Throttle
Output: Torque (from lookup table)
Automotive Example:
An engine torque map uses RPM and throttle position as inputs to determine torque output.
The Saturation block limits signal values within defined upper and lower bounds.
| Concept | Description |
|---|---|
| Function | Restricts signal within specified limits |
| Upper Limit | Maximum allowable value |
| Lower Limit | Minimum allowable value |
| Usage | Prevents signals from exceeding safe range |
Example:
if input > upper limit → output = upper limit
if input < lower limit → output = lower limit
Automotive Example:
The Saturation block is used to limit throttle command signals within safe operating limits.
The Unit Delay block delays the input signal by one sample time step.
| Concept | Description |
|---|---|
| Function | Delays signal by one sample |
| Type | Discrete-time block |
| Usage | Used in digital and discrete systems |
Example:
Output(k) = Input(k-1)
Automotive Example:
The Unit Delay block is used in implementing discrete controllers in automotive control systems.
The Memory block outputs the previous input value during the current time step.
| Concept | Description |
|---|---|
| Function | Stores and outputs previous input |
| Timing | Works within the same simulation step |
| Usage | Helps in handling feedback and loops |
Example:
Output(t) = Input(previous step)
Automotive Example:
The Memory block is used to break algebraic loops in feedback control systems.
The Integrator block calculates the integral of the input signal over time.
| Concept | Description |
|---|---|
| Function | Performs continuous-time integration |
| Operation | Accumulates input signal over time |
| Usage | Used in dynamic system modeling |
Example:
Output = ∫ Input dt
Automotive Example:
The Integrator block is used to calculate vehicle position from speed signals.
The Discrete Integrator block performs integration of input signals in discrete-time systems.
| Concept | Description |
|---|---|
| Function | Integrates input signal at discrete intervals |
| Type | Discrete-time block |
| Usage | Used in digital control and estimation systems |
Example:
Output(k) = Output(k-1) + Input(k) * Ts
Automotive Example:
The Discrete Integrator block is used in speed estimation algorithms in automotive systems.
The Derivative block computes the rate of change of the input signal with respect to time.
| Concept | Description |
|---|---|
| Function | Calculates derivative of input signal |
| Formula | Output = d(Input)/dt |
| Usage | Used to determine rate of change |
Example:
Output = d(Input)/dt
Automotive Example:
The Derivative block is used to calculate vehicle acceleration from speed signals.
The Transfer Function block represents system dynamics using numerator and denominator polynomials.
| Concept | Description |
|---|---|
| Function | Models linear system behavior |
| Representation | Uses ratio of polynomials in Laplace domain |
| Usage | Used in control system modeling |
Example:
G(s) = (s + 2) / (s² + 3s + 2)
Automotive Example:
The Transfer Function block is used to model engine dynamics and system response.
The PID Controller block implements proportional, integral, and derivative control to regulate system output.
| Component | Description |
|---|---|
| Proportional (Kp) | Responds to present error |
| Integral (Ki) | Accounts for past error |
| Derivative (Kd) | Predicts future error |
Example:
u(t) = Kp e(t) + Ki ∫e(t)dt + Kd de/dt
Automotive Example:
The PID Controller block is used in cruise control systems to maintain desired vehicle speed.
The Rate Limiter block limits the rate of change of an input signal over time.
| Concept | Description |
|---|---|
| Function | Restricts how fast a signal can increase or decrease |
| Control | Uses rising and falling rate limits |
| Usage | Prevents abrupt changes in signals |
Example:
Rate of change ≤ specified limit
Automotive Example:
The Rate Limiter block is used to prevent sudden throttle changes for smoother vehicle response.
The Dead Zone block outputs zero when the input signal lies within a specified range.
| Concept | Description |
|---|---|
| Function | Eliminates small input variations |
| Range | Defined upper and lower bounds |
| Usage | Used to ignore noise or insignificant signals |
Example:
if input within range → output = 0
else → output = input
Automotive Example:
The Dead Zone block is used to filter small sensor noise around zero.
The Mux block combines multiple input signals into a single vector signal.
| Concept | Description |
|---|---|
| Function | Combines multiple signals into one |
| Output | Produces a vector signal |
| Usage | Used to group signals for processing |
Example:
Input1 = speed
Input2 = temperature
Output = [speed, temperature]
Automotive Example:
The Mux block is used to combine multiple sensor signals for processing in control systems.
The Demux block separates a vector signal into multiple individual output signals.
| Concept | Description |
|---|---|
| Function | Splits a vector signal into multiple outputs |
| Input | Takes a combined vector signal |
| Usage | Used to distribute signals for further processing |
Example:
Input = [speed, temperature]
Output1 = speed
Output2 = temperature
Automotive Example:
The Demux block is used to separate signals from a sensor fusion module for individual processing.
The Bus Creator block groups multiple signals into a single bus signal structure.
| Concept | Description |
|---|---|
| Function | Combines signals into a structured bus |
| Output | Bus signal with named elements |
| Usage | Used for organized signal management |
Example:
Bus = {speed, temperature, pressure}
Automotive Example:
The Bus Creator block is used to group signals for transmission over vehicle CAN messages.
The Bus Selector block extracts specific signals from a bus signal.
| Concept | Description |
|---|---|
| Function | Selects required signals from a bus |
| Input | Receives a structured bus signal |
| Usage | Used to access individual signals |
Example:
Bus = {speed, temperature, pressure}
Output = speed
Automotive Example:
The Bus Selector block is used to extract vehicle speed from a CAN message bus.
The Goto and From blocks are used for signal routing without drawing long signal lines.
| Block | Description |
|---|---|
| Goto | Sends a signal to a tag |
| From | Receives a signal using the same tag |
| Usage | Simplifies connections in large models |
Example:
Goto tag: speed_signal
From block receives: speed_signal
Automotive Example:
The Goto/From blocks are used to route signals efficiently across large vehicle system models.
An Enabled Subsystem executes only when the enable signal is active.
| Concept | Description |
|---|---|
| Function | Controls execution based on enable signal |
| Condition | Runs only when enable input is true |
| Usage | Used for conditional execution of logic |
Example:
if enable == 1
subsystem runs
else
subsystem is inactive
Automotive Example:
The Enabled Subsystem is used for control logic that runs only when the vehicle ignition is ON.
A Triggered Subsystem executes only when a specified trigger event occurs.
| Concept | Description |
|---|---|
| Function | Executes based on trigger signal |
| Trigger Types | Rising edge, Falling edge, Either edge |
| Usage | Used for event-driven execution |
Example:
Trigger on rising edge → subsystem executes
Automotive Example:
The Triggered Subsystem is used to execute diagnostics when a fault signal occurs.
The MATLAB Function block allows engineers to write MATLAB code directly inside a Simulink model.
| Feature | Description |
|---|---|
| Algorithm Implementation | Write custom logic using MATLAB code |
| Conditional Logic | Supports if-else and switch conditions |
| Loops | Enables for-loops and while-loops |
| Custom Computation | Perform complex mathematical operations |
| Code Generation | Supports automatic C code generation |
Example:
function y = controlLogic(u)
if u > 50
y = 1;
else
y = 0;
end
Automotive Example:
Implementing gear shift logic using conditional MATLAB code inside a Simulink model.
The Interpreted MATLAB Function block executes MATLAB code during simulation only.
| Feature | Description |
|---|---|
| Execution | Runs MATLAB code during simulation time |
| Dynamic Function Calls | Calls MATLAB functions directly |
| Code Generation | Does not support code generation |
| Usage | Useful for testing and rapid prototyping |
Example:
y = sin(u); % Interpreted during simulation
Automotive Example:
Quick prototyping of signal processing algorithms before implementing optimized production code.
This block compares an input signal to a constant value.
| Feature | Description |
|---|---|
| Comparison | Compares input signal with a fixed constant |
| Operators | Supports >, <, ==, >=, <= |
| Output | Produces a Boolean (true/false) signal |
| Usage | Used for decision-making and condition checking |
Example:
u > 100 % Output is true if input exceeds constant value
Automotive Example:
Detecting vehicle overspeed condition when speed exceeds a predefined limit.
This block compares a signal value with zero.
| Feature | Description |
|---|---|
| Comparison | Compares input signal with zero |
| Operators | Supports > 0, < 0, == 0, >= 0, <= 0 |
| Output | Produces a Boolean (true/false) signal |
| Usage | Used for checking signal polarity or zero conditions |
Example:
u < 0 % Output is true if input is negative
Automotive Example:
Detecting negative torque request values in vehicle control systems.
The Logical Operator block performs logical operations on input signals for decision-making.
| Operator | Description |
|---|---|
| AND | True if all inputs are true |
| OR | True if any input is true |
| NOT | Inverts the input signal |
| XOR | True if inputs are different |
Example:
y = (u1 && u2); % AND operation
Automotive Example:
Brake is applied AND vehicle speed is greater than a threshold to trigger safety actions.
The MinMax block outputs the minimum or maximum value among multiple input signals.
| Mode | Description |
|---|---|
| Min | Outputs the smallest value among inputs |
| Max | Outputs the largest value among inputs |
Example:
y = max(u1, u2); % Maximum of two inputs
Automotive Example:
Selecting the maximum torque request from different control modules in a vehicle system.
The Abs block computes the absolute value of the input signal.
| Feature | Description |
|---|---|
| Operation | Calculates magnitude without sign |
| Formula | Output = |Input| |
| Usage | Removes negative sign from signal values |
Example:
y = abs(u); % Absolute value of input
Automotive Example:
Calculating the magnitude of speed error regardless of direction.
The Sign block outputs the sign of the input signal.
| Input | Output |
|---|---|
| Positive | 1 |
| Zero | 0 |
| Negative | -1 |
Example:
y = sign(u); % Returns 1, 0, or -1
Automotive Example:
Determining the direction of vehicle motion (forward or reverse).
The Bias block adds a constant value (bias) to the input signal.
| Feature | Description |
|---|---|
| Operation | Adds a fixed constant to input |
| Formula | Output = Input + Bias |
| Usage | Used for signal adjustment or offset correction |
Example:
y = u + 5; % Adds bias of 5 to input
Automotive Example:
Offset correction for sensor calibration to ensure accurate readings.
The Quantizer block converts continuous input values into discrete levels.
| Feature | Description |
|---|---|
| Operation | Maps continuous signals to discrete steps |
| Usage | Simulates quantization effects in systems |
| Applications | ADC behavior and sensor resolution modeling |
Example:
y = round(u / q) * q; % Quantization with step size q
Automotive Example:
Simulating analog sensor digitization to represent real-world sensor resolution.
The Zero-Order Hold block holds the input value constant between sampling intervals.
| Feature | Description |
|---|---|
| Operation | Maintains last sampled value until next update |
| Function | Converts continuous signals into discrete signals |
| Usage | Used in digital control and signal processing |
Example:
y(k) = u(kT); % Holds value between sampling instants
Automotive Example:
Sampling vehicle speed signal at fixed intervals for ECU processing.
The Hit Crossing block detects when a signal crosses a specified threshold value.
| Feature | Description |
|---|---|
| Detection | Identifies when signal crosses a set threshold |
| Direction | Can detect rising, falling, or either crossing |
| Output | Generates an event or trigger signal |
| Usage | Used for event detection in control systems |
Example:
u crosses 6000 % Detect crossing of threshold
Automotive Example:
Detecting engine RPM crossing the redline threshold to trigger warnings or control actions.
The Relay block switches the output between two values based on input thresholds.
| Feature | Description |
|---|---|
| Operation | Switches output between ON and OFF states |
| Thresholds | Uses upper and lower limits for switching |
| Hysteresis | Prevents rapid switching due to small fluctuations |
| Usage | Used for control systems with ON/OFF logic |
Example:
if u > upper_limit
y = ON;
elseif u < lower_limit
y = OFF;
end
Automotive Example:
Cooling fan ON/OFF control based on engine temperature using hysteresis to avoid frequent switching.
The Detect Rise Positive block detects rising edge transitions in input signals.
| Feature | Description |
|---|---|
| Detection | Identifies transition from 0 to 1 |
| Edge Type | Rising (positive) edge |
| Output | Generates a pulse when transition occurs |
| Usage | Used for event triggering and signal monitoring |
Example:
if (u(k-1) == 0) && (u(k) == 1)
y = 1;
end
Automotive Example:
Detecting a button press event in vehicle control systems.
The Detect Fall Negative block detects falling edge transitions in input signals.
| Feature | Description |
|---|---|
| Detection | Identifies transition from 1 to 0 |
| Edge Type | Falling (negative) edge |
| Output | Generates a pulse when transition occurs |
| Usage | Used for event detection and control logic |
Example:
if (u(k-1) == 1) && (u(k) == 0)
y = 1;
end
Automotive Example:
Detecting brake pedal release events in vehicle systems.
The Edge Detector block detects transitions in input signals.
| Edge Type | Description |
|---|---|
| Rising | Detects transition from 0 to 1 |
| Falling | Detects transition from 1 to 0 |
| Both | Detects both rising and falling edges |
Example:
Edge detection on u(k) % Detects change in signal state
Automotive Example:
Detecting ignition key transitions such as ON/OFF state changes.
The Signal Specification block explicitly defines signal attributes within a Simulink model.
| Attribute | Description |
|---|---|
| Data Type | Specifies the type of signal (e.g., int, double) |
| Dimensions | Defines size and shape of the signal |
| Sample Time | Sets the timing for signal updates |
Example:
Set signal type = int16
Set dimensions = [1x1]
Set sample time = 0.01
Automotive Example:
Ensuring integer data types for ECU code generation to meet embedded system requirements.
The Data Type Conversion block converts a signal from one data type to another.
| Conversion Type | Description |
|---|---|
| double → int16 | Converts floating-point to integer format |
| float → fixed-point | Converts to fixed-point representation |
| Integer → Boolean | Converts numeric values to logical signals |
| Usage | Ensures compatibility between different blocks |
Example:
y = int16(u); % Convert input to 16-bit integer
Automotive Example:
Preparing signals to match ECU hardware constraints such as fixed-point or integer formats.
The Selector block extracts specific elements from vector or matrix signals.
| Feature | Description |
|---|---|
| Operation | Selects specific indices from input signal |
| Input Type | Works with vectors and matrices |
| Flexibility | Supports indexing by position or range |
| Usage | Used for signal extraction and routing |
Example:
y = u(2); % Extract second element from vector
Automotive Example:
Extracting individual wheel speeds from a sensor array for control systems.
The Assignment block replaces specific elements in a vector or matrix signal.
| Feature | Description |
|---|---|
| Operation | Updates selected indices with new values |
| Input Type | Works with vectors and matrices |
| Indexing | Allows position-based element replacement |
| Usage | Used for modifying signal data dynamically |
Example:
u(3) = 10; % Replace third element with 10
Automotive Example:
Updating specific state values in control logic such as modifying a particular parameter in a state vector.
The For Iterator Subsystem executes its contents repeatedly for a specified number of iterations.
| Feature | Description |
|---|---|
| Iteration | Runs subsystem multiple times in a loop |
| Control | Number of iterations is predefined |
| Execution | Processes data sequentially within each iteration |
| Usage | Used for repetitive computations |
Example:
for i = 1:N
y(i) = u(i) * 2;
end
Automotive Example:
Performing iterative computations in sensor fusion algorithms for improved accuracy.
The While Iterator Subsystem executes repeatedly as long as a specified condition remains true.
| Feature | Description |
|---|---|
| Iteration | Runs subsystem in a loop based on condition |
| Control | Execution continues while condition is true |
| Termination | Stops when condition becomes false |
| Usage | Used for condition-based repetitive processing |
Example:
while u > 0
u = u - 1;
end
Automotive Example:
Running an iterative fault detection algorithm until a fault condition is cleared.
An Enabled and Triggered Subsystem executes only when both an enable condition is true and a trigger event occurs.
| Condition | Description |
|---|---|
| Enable | Subsystem runs only when enable signal is true |
| Trigger | Execution occurs on a specific event (e.g., rising edge) |
| Combined Logic | Both conditions must be satisfied for execution |
| Usage | Used for event-driven and conditional processing |
Example:
if (enable == 1) && (trigger_event)
execute subsystem;
end
Automotive Example:
Running diagnostic logic only when the system is enabled and a specific event (like ignition ON) occurs.
The Variant Subsystem allows multiple implementations of a component within a single Simulink model.
| Selection Basis | Description |
|---|---|
| Configuration Parameter | Selects variant based on predefined settings |
| Simulation Mode | Chooses implementation during simulation |
| Flexibility | Supports multiple design alternatives in one model |
| Usage | Used for managing different system configurations |
Example:
if (mode == 1)
use Variant A;
else
use Variant B;
end
Automotive Example:
Supporting different vehicle variants (e.g., petrol, diesel, electric) using the same model framework.
A Function-Call Subsystem executes when triggered by a function-call signal.
| Feature | Description |
|---|---|
| Execution | Runs only when a function-call trigger is received |
| Control Flow | Used to manage execution order of subsystems |
| Scheduling | Supports task scheduling mechanisms |
| Usage | Used in event-driven and modular designs |
Example:
function_call()
→ executes subsystem
Automotive Example:
Scheduling ECU tasks based on periodic or event-driven scheduler signals.