Labs
Labs
Labs
Objective
• To obtain and analyze the step, impulse, and ramp responses of a given first-order system.
• To determine the system parameters (time constant τ\tauτ and DC gain KKK) using the step
response.
Where:
• τ\tauτ: Time constant (time taken to reach 63% of the final value),
For the given system, perform the following procedures in the lab:
Step Response
1. Setup:
o Connect the system to the power supply and apply a 10 Hz square wave as the input.
2. Measurement:
o Observe the system output and note the steady-state value of the response.
o Determine τ\tauτ: the time it takes for the system to reach 63%63\%63% of its final
value.
o Compute KKK: the steady-state value of the output divided by the input amplitude.
3. Plotting:
o The plot should resemble an exponentially rising curve approaching the steady-state
value.
4. Simulation:
o Use MATLAB to simulate the step response of the derived transfer function:
G(s)=Kτs+1G(s) = \frac{K}{\tau s + 1}G(s)=τs+1K
Impulse Response
1. Setup:
o Adjust the duty cycle of the square wave such that the "on" time becomes very small,
approximating an impulse input.
2. Observation:
3. Plotting:
Ramp Response
1. Setup:
2. Measurement:
o Measure the deviation of the system’s output from the ramp input.
3. Plotting:
1. Determine KKK:
o The steady-state output value divided by the input amplitude gives KKK.
2. Determine τ\tauτ:
o Measure the time it takes for the output to reach 63%63\%63% of its final value.
Step 5: Calculations
Final Report
Summarize all plots, calculations, and MATLAB simulation comparisons in your lab report. Ensure you
comment on discrepancies between theoretical and practical results and suggest possible reasons (e.g.,
system noise, delays, hardware limitations).
• To analyze the step, impulse, and ramp responses of a second-order system.
Prerequisites:
Theory:
Second-Order Systems:
A system is termed second-order if the highest power of sss in the denominator of its transfer function
is 2.
Where:
Step Response:
A step signal transitions instantaneously from one value to another. The system’s step response
reveals key characteristics like rise time, overshoot, and settling time.
Procedure:
Impulse Response:
An impulse signal has an instantaneous value change from zero to infinity. The impulse response
characterizes the system completely if it is linear and time-invariant (LTI).
Procedure:
1. Decrease the duty cycle of the square wave from the step response to approximate an impulse
input.
2. Apply the signal to the input terminal and observe the system's response.
Ramp Response:
A ramp signal increases linearly with time. The system's ramp response deviates by a constant time lag
TTT.
Procedure:
2. Increase the frequency until the response resembles the theoretical ramp response.
System identification estimates system parameters based on input-output data. The step response
characteristics such as overshoot, rise time, and settling time are key to identifying parameters like:
Procedure:
1. Measure step response characteristics (overshoot, rise time, steady-state value, etc.).
4. Simulate the step response in MATLAB and compare it with the experimental response.
Lab Task #1: Sensor Calibration
Objective: Calibrate the PT100 temperature sensor to establish a relationship between temperature and
output voltage (1V per 10°C).
Key Steps:
1. Use a multimeter to measure and set resistance at two reference points (0°C and 100°C).
3. Verify the output voltage corresponds to the calibrated temperature values (0V for 0°C and 10V
for 100°C).
Expected Result:
• Accurate sensor calibration ensures precise temperature readings for subsequent control tasks.
Objective: Implement a basic On/Off controller to maintain the water temperature at a set point.
Key Steps:
1. Establish connections for the water pump, heater driver, and temperature sensor.
3. Monitor the temperature's rise and fall cycles using the voltmeter and note the corresponding
up and down times in Table 20.1.
4. Observe the behavior of the On/Off controller as the heater activates/deactivates around the set
point.
Expected Result:
• Oscillations in temperature within the hysteresis band due to the controller toggling the heater.
Key Steps:
2. Repeat the observations from Task #2, now with a modified hysteresis band.
3. Record the up and down times, upper and lower temperature limits in the table.
Expected Result:
• Wider hysteresis reduces the frequency of switching but allows for greater temperature
oscillations around the set point.
Analysis & Observations
Hysteresis Diagram
• Fig. 20.3 and Fig. 20.4 will illustrate the characteristic behavior of the On/Off controller,
showcasing the upper and lower limits around the set point.
• The hysteresis band creates a dead zone where the controller does not switch, avoiding rapid
toggling and increasing system stability.
Performance Metrics
1. Up Limit (Set Point): Maximum temperature the system reaches before the heater switches off.
2. Lower Limit: Minimum temperature the system reaches before the heater switches on.
3. Temperature Rising/Falling Times: The time taken for the system to heat or cool within the
hysteresis band.
Expected Behavior
Diagrams
Key Takeaways
1. An On/Off controller with hysteresis is simple and cost-effective but may not be suitable for
processes requiring tight control.
2. Calibration is critical to ensure accurate sensor readings, forming the foundation for effective
control.
3. Observing the system's performance with and without hysteresis highlights the trade-offs
between stability and precision.
Lab Task #01: Close-loop Transfer Function
3. Set Set-point:
o Record the sensor's output value and the time taken to reach the final value.
For a first-order system with proportional control: G(s)=Kτs+1G(s) = \frac{K}{\tau s + 1}G(s)=τs+1K Where:
2. Design Adjustments:
1. Setup on Trainer:
3. Record Observations:
Objective
To familiarize attendees with the Ziegler-Nichols PID tuning rule and apply it to control the position of
the ball on a beam.
Theory
PID Controller
• Derivative (D): Predicts future errors based on the current rate of change.
Steps:
2. Gradually increase KpK_pKp until sustained oscillations occur. This value is KmK_mKm, the
marginal gain.
4. Use KmK_mKm and TmT_mTm in Ziegler-Nichols formulas to calculate KpK_pKp, TiT_iTi, and
TdT_dTd.
Lab Task
Given Setup
• Td=0.125 Tm=0.125×2.8=0.35 sT_d = 0.125 \, T_m = 0.125 \times 2.8 = 0.35 \, \text{s}Td
=0.125Tm=0.125×2.8=0.35s
Further Refinement
Refined values:
• Kp=39K_p = 39Kp=39, Ti=3.07 sT_i = 3.07 \, \text{s}Ti=3.07s, Td=0.75 sT_d = 0.75 \, \text{s}Td
=0.75s.
o Transfer Function block to represent the plant (Ball and Beam system).
o Step input.
5. Fine-tune the parameters to minimize overshoot and settling time, using refined values
Kp=39K_p = 39Kp=39, Ti=3.07T_i = 3.07Ti=3.07, Td=0.75T_d = 0.75Td=0.75.
Deliverables
• Results:
Objective Recap
The lab involves designing a lead compensator to stabilize and control the position of an inverted
pendulum. The compensator aims to meet specific transient response criteria.
Theory Refresher
Lead Compensator:
• It bends the root locus, placing poles closer to desired locations in the s-plane.
Design Parameters:
1. Set Up MATLAB/Simulink:
o Use the Motor Encoder block to read the motor's angular position and velocity.
o Use the Stepper Motor block for driving the motor with calculated control input.
o Include the inverted pendulum system, the lead compensator, and the feedback loop.
3. Submission:
o Save and share the Simulink block diagram as part of the submission.
Lab Task #02: Design and Validate Lead Compensator
2. Performance Criteria:
iii. Calculate Desired Pole Locations: Compute dominant poles (sss) using:
o Choose a zero (zzz) arbitrarily on the left-half plane (e.g., z=−10z = -10z=−10).
4. Simulate in Simulink:
o Analyze the closed-loop response and confirm the criteria (Ts=0.5T_s = 0.5Ts=0.5,
Mp≤10%M_p \leq 10\%Mp≤10%).
5. Experimental Validation:
1. Task 01:
2. Task 02:
Objective Recap
Theory Summary
Lag Compensator:
• Adds a zero (zcz_czc) and a pole (pcp_cpc), where zc/pcz_c/p_czc/pc ratio determines
improvement in steady-state error.
• To minimize angular contributions, the pole-zero pair is placed close to the origin.
Lag-Lead Compensator:
Given System:
1. Given Requirements:
o Interface with the inverted pendulum system using encoder and motor drivers.
2. Compare Results:
Deliverables
1. Task 01:
2. Task 02:
In this part, you'll measure the output amplitude and phase shift at different frequencies (1 Hz, 100 Hz, 1
kHz, and 10 kHz), then calculate the gain in dB and phase delay for each frequency.
You need to repeat the steps for 100 Hz, 1 kHz, and 10 kHz.
Once you have the gain and phase delay for each frequency, you can plot the magnitude and phase
response on a Bode plot. The magnitude plot will show the gain in decibels, and the phase plot will show
the phase in degrees.
• Since the phase plot will have a final slope of approximately -90° per pole, the system will have a
first-order phase behavior (indicating a first-order system).
• The number of poles is identified by the slope of the magnitude plot. If the slope is -20 dB/dec,
this corresponds to a single pole.
• The magnitude plot will help you identify if there are additional poles or zeros.
• From the phase plot, we identify the break frequencies. The first pole appears at 0 rad/s, and the
second pole occurs at approximately 5 rad/s.
K = 25; % Gain
bode(sys);
grid on;
This MATLAB script will create a Bode plot of the system with the transfer function G(s)=25ss+5G(s) =
\frac{25s}{s + 5}G(s)=s+525s, showing both the magnitude and phase response. The resulting Bode plot
can be compared with the experimental results you obtained in Task #1 to validate the system behavior.
From the Bode plot, you estimated the transfer function as:
This transfer function reflects a system with a first-order behavior and a gain of 25, with a pole at -5.
Objective
To familiarize the attendee with the magnetic levitation system and design a PID controller to stabilize a
metal sphere at a specific position by applying electromagnetic force to counteract gravity.
Theory
Magnetic Levitation:
Magnetic levitation involves suspending a metal sphere in the air using electromagnetic force. This force
is generated by an electromagnet and counteracts the force of gravity acting on the sphere. The
equilibrium of the sphere occurs when:
Where:
To maintain this equilibrium, a closed-loop control system is required. The system continuously measures
the sphere's position and adjusts the current flowing through the electromagnet to stabilize the sphere.
A PID controller is often used to achieve this stabilization.
Laser Displacement Sensor:
The laser displacement sensor is a key component in the magnetic levitation system, providing non-
contact measurement of the sphere's position. Its working principle is based on laser pulse technology,
which determines the distance between the sensor and the sphere by calculating the time taken for the
laser to reflect back to the sensor.
• High precision
• Non-contact measurement
Lab Tasks
o Place the GML2001 standard ball (diameter: 45 mm) at the bottom of the
electromagnet.
o Measure the average voltage UoutU_{\text{out}}Uout when the sphere is at the bottom.
o Input this value into the zero module and hold for at least 10 seconds.
1. Objective:
o Design and tune a PID controller to stabilize the metal sphere near the electromagnet by
maintaining its position within the laser sensor's range.
2. Steps to Design the PID Controller:
o Analyze the system dynamics and determine the transfer function for the magnetic
levitation system.
o Tune the PID parameters (Kp,Ki,KdK_p, K_i, K_dKp,Ki,Kd) to minimize the error and
stabilize the sphere:
▪ Derivative (D): Predicts and counteracts future errors based on the rate of
change.
o Test the tuned PID controller on the physical magnetic levitation setup.
o Observe the sphere's response and make further adjustments to PID parameters as
necessary to achieve stability and fast response.
Deliverables:
3. PID parameters (Kp,Ki,KdK_p, K_i, K_dKp,Ki,Kd) and their effect on system performance.