Posts

NOT Logic

Image
⚙️ Implementing Logical NOT Operation Using Only Basic Simulink Blocks When building logic-based control or decision systems in Simulink , we often need to use logical operations such as AND, OR, and NOT. While Simulink provides dedicated blocks for these operations (like the Logical Operator block), there are situations where you might want or be required to implement the same logic manually using only basic blocks . This explains how to implement the Logical NOT operation — without using the built-in Logical Operator block — using simple Simulink components. Use Case 1:  By inputting the value to 0 with the help of manual switch, the actual & expected Output would be 1. Use Case 2:  By inputting the value to 1 with the help of manual switch, the actual & expected Output would be 0. Results: Conclusion: Logical NOT can be implemented easily using basic arithmetic or relational blocks . The 1 - u method is the simplest and most efficient. Use Relational Oper...

Saturation Block

Image
 ðŸš—Implementing Saturation Block Logic Without Using the Built-In Saturation Block in Simulink When working on control systems or signal conditioning in Simulink , you’ll often need to limit a signal within a certain range — for example, to ensure an actuator input never exceeds its physical constraints or to prevent numeric overflow. Simulink provides a convenient Saturation block , but what if you want to implement the same functionality manually — for learning, custom modeling, or to comply with modeling guidelines (like MAAB or ISO 26262) ... (i) By using Simulink Method: Use Case 1: By inputting the value to 0 with the help of manual switch, the Output will be 0. Use Case 2:  By inputting the value to 1.1 with the help of manual switch, the Output will be 1. Simulink Blocks Used: 1. Inport 2. Constant 3. Manual Switch 4. MinMax 5. Outport (ii) By using MATLAB Scripting Method: Results: Conclusion: Saturation can be implemented easily without using the built-in block. T...

Numerical Methods

Image
Simulating Dynamics: Unveiling Numerical Methods with MATLAB and Simulink Have you ever wondered how software like Simulink solves those complex differential equations that govern dynamic systems? Or how we can predict the behavior of an electrical circuit, a falling object, or a chemical reaction over time? The answer lies in numerical methods , powerful algorithms that approximate the solutions to Ordinary Differential Equations (ODEs). In the world of digital simulation, we can't truly represent continuous time. Instead, we break time into tiny, discrete steps and use numerical methods to estimate the system's state at each subsequent step. Today, we'll dive into two popular and foundational numerical methods – the Modified Euler Method and the Runge-Kutta (RK4) Method – and see how we can implement and compare them using the power of MATLAB and Simulink. Problem Statement: 1.  The Modified Euler Method (Heun's Method): The standard (Forward) Euler method is simple...

Variant Subsystem

Image
The Power of Flexibility: Mastering Variant Subsystems in Simulink Variant Subsystem: It is a special type of subsystem block in Simulink that contains multiple child subsystems (or blocks) representing different functional implementations. Each child is associated with a variant condition (a logical expression). When the model is compiled or simulated, Simulink evaluates these conditions and activates only the variant whose condition is true. The inactive variants are essentially ignored, as if they don't exist in the model. Example:  A Vehicle Suspension System with Different Damper Types  (e.g., standard, sport, comfort) that require different mathematical models. Let's use a Variant Subsystem to manage this. 1. Standard Damper (MyDamperType = 1): When the condition MyDamperType = 1 met, the standard variant subsystem will be simulated, and other subsystems / variants are ignored. Result: 2. Sport Damper (MyDamperType = 2):   When the condition MyDamperType = 2 m...

Triggered Subsystem

Image
Event-Driven Power: Unleashing Logic with Simulink Triggered Subsystems Triggered Subsystem:  A Triggered Subsystem is a type of Simulink subsystem that only executes its contents (the blocks and signals inside it) when a specific condition is met on its trigger port . Unlike an Enabled Subsystem (which executes while a signal is high), a Triggered Subsystem responds to a change in the trigger signal – typically a rising edge, a falling edge, or either edge. Example:  A Simple Counter Triggered by a Button Press, ( where a counter increments / decrements  only when a "button" is pressed (simulated by a pulse). The counter will hold its value between presses). 1. Rising Edge: W here a counter increments by 1 in every 10 seconds  only   when a "button" is pressed. Result: 2. Falling Edge:  W here a counter decrements by 1 in every 10 seconds  only   when a "button" is pressed. Result: Key Advantages: 1. Event-Driven Execution: Execute logic only ...

Enabled Subsystem

Image
Take Control: How to Use Enabled Subsystems in Simulink Enabled Subsystem: An Enabled Subsystem is a type of Simulink subsystem that only executes its contents (the blocks and signals inside it) when it enable port receives a positive control signal (or a rising edge, depending on configuration). When the enable signal is zero or inactive, the subsystem "pauses" and its internal states hold their last values. Example: A Temperature-Controlled Heater where a "Heater" only turns on (and warms up) when the "Room Temperature" drops below 20 degrees Celsius. 1. Positive Control Signal (Enabled):   If the condition became true, then the system will be enabled, and the logic will be executed. 2. Zero / Inactive Signal (Disabled):   If the condition became false, then the system won't be enabled, and the logic will not be executed. Key Advantages: Conditional Execution: The most obvious benefit – run logic only when needed, saving computational resources. ...

Simulink Solver

Image
Mastering Your Simulation Speed & Accuracy: A Deep Dive into Simulink Solvers Fixed-Step Solvers: Predictable & Powerful for Real-Time   Fixed-step solvers march through your simulation using a constant time interval (the "step size"). This step size never changes, regardless of what's happening in your model. Model Configuration Setting: Simulink Model for showcasing how the step size is considering for the system / pre-defined for the system. Exported Result from "To Workspace" Block Result:                 Common Fixed-Step Solvers in Simulink: - ode1 (Euler) - ode1be (Backward Euler)   - ode2 (Heun) - ode3 (Bogacki-Shampine) - ode4 (Runge-Kutta) - ode5 (Dormand-Prince) - ode8 (Dormand-Prince) - ode14x (extrapolation) - Discrete (for purely discrete-time models) - FixedStepAuto (Simulink automatically selects an appropriate fixed-step solver and step size based on model characteristics). Variable-Step Solvers:...