0
0
Simulinkdata~10 mins

Speed control with PID in Simulink - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Speed control with PID
Set desired speed (Setpoint)
Measure actual speed (Feedback)
Calculate error = Setpoint - Feedback
PID Controller: Compute control signal
Apply control signal to motor
Motor speed changes
Loop back: Measure new speed
The system compares desired speed with actual speed, calculates error, uses PID to adjust control signal, and updates motor speed in a loop.
Execution Sample
Simulink
error = setpoint - actual_speed
control_signal = Kp*error + Ki*integral(error) + Kd*derivative(error)
motor_speed = motor_speed + control_signal
actual_speed = measure_speed(motor_speed)
This code calculates the error, applies PID formula to get control signal, updates motor speed, and measures new speed.
Execution Table
StepSetpointActual SpeedErrorIntegral of ErrorDerivative of ErrorControl SignalMotor Speed
11000100100100150150
2100150-5050-15020170
3100170-70-20-2010180
4100180-80-100-105185
5100185-85-185-52187
Exit100187-87-272-20187
💡 Motor speed stabilizes near setpoint, error becomes small, control signal approaches zero
Variable Tracker
VariableStartAfter 1After 2After 3After 4After 5Final
Setpoint100100100100100100100
Actual Speed0150170180185187187
Error100-50-70-80-85-87-87
Integral of Error010050-20-100-185-272
Derivative of Error0100-150-20-10-5-2
Control Signal01502010520
Motor Speed0150170180185187187
Key Moments - 3 Insights
Why does the error become negative after the first step?
Because the actual speed overshoots the setpoint, making actual_speed > setpoint, so error = setpoint - actual_speed becomes negative (see execution_table step 2).
Why does the control signal decrease over time even if error is still negative?
The integral and derivative terms adjust the control signal to reduce overshoot and stabilize speed, so control signal decreases as error magnitude reduces (see execution_table steps 3 to 5).
Why does motor speed not instantly reach setpoint?
Because the motor responds gradually to control signals and physical limits, so speed changes step-by-step as control signal is applied (see motor speed column in execution_table).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the error value at step 3?
A-70
B-50
C100
D-80
💡 Hint
Check the 'Error' column at row with Step '3' in the execution_table.
At which step does the control signal first drop below 20?
AStep 2
BStep 3
CStep 4
DStep 5
💡 Hint
Look at the 'Control Signal' column in execution_table and find when it goes below 20.
If the setpoint was increased to 120, how would the initial error at step 1 change?
AIt would be 100
BIt would be 0
CIt would be 120
DIt would be -120
💡 Hint
Error = setpoint - actual_speed; actual_speed starts at 0, so error equals setpoint at step 1.
Concept Snapshot
Speed control with PID:
- Measure error = desired speed - actual speed
- PID computes control signal from error, integral, derivative
- Control signal adjusts motor speed
- Loop repeats to stabilize speed near setpoint
- Integral reduces steady error, derivative reduces overshoot
Full Transcript
This visual execution shows how a PID controller manages motor speed. We start with a desired speed (setpoint) and measure actual speed. The error is the difference. The PID controller calculates a control signal using proportional, integral, and derivative parts of the error. This signal adjusts the motor speed. Over steps, the motor speed approaches the setpoint, error reduces, and control signal stabilizes near zero. Key points include error sign changes when speed overshoots, control signal adjustments to prevent oscillations, and gradual motor response. The execution table tracks all variables step-by-step for clear understanding.