TCLab FOPDT Model
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|---|
Objective: Collect step response data from the TCLab and compute parameters of an FOPDT model.
A first order plus dead time (FOPDT) model of the Temperature Control Lab (TCLab) is the following:
$$\tau_p \frac{dT'}{dt} = -T' + K_p \, Q'\left(t-\theta_p\right)$$
where `T'=T-T_{ss}` and `Q'=Q-Q_{ss}` are deviation variables with steady-state initial conditions `T_{ss}=23^oC` and `Q_{ss}=0 \%`. Perform a step test with heater 1 starting at 0% for 0.5 minutes (30 seconds) and then step the heater to 70% for 7.5 minutes. Create a plot of the temperature response over 8 minutes that also shows the heater level (%). Sample source code for generating the response is provided below.
import matplotlib.pyplot as plt
import tclab
import time
n = 480 # Number of second time points (8 min)
tm = np.linspace(0,n,n+1) # Time values
# data
lab = tclab.TCLab()
T1 = [lab.T1]
Q1 = np.zeros(n+1)
Q1[30:] = 70.0
for i in range(n):
lab.Q1(Q1[i])
time.sleep(1)
print(lab.T1)
T1.append(lab.T1)
lab.close()
# Create Figure
plt.figure(figsize=(12,8))
ax = plt.subplot(2,1,1)
ax.grid()
plt.plot(tm/60.0,T1,'r.',label=r'$T_1$')
plt.ylabel(r'Temp ($^oC$)')
ax = plt.subplot(2,1,2)
ax.grid()
plt.plot(tm/60.0,Q1,'b-',label=r'$Q_1$')
plt.ylabel(r'Heater (%)')
plt.xlabel('Time (min)')
plt.legend()
plt.savefig('Step_Response.png')
plt.show()
Open the TCLab web interface or run the script with the TCLab device connected to generate the figure Step_Response.png. Use the figure to calculate the values of `K_p`, `\tau_p`, and `\theta_p` as shown in the procedure for graphical fitting of FOPDT models. Specify units for each of the parameters.
Solution
Generative AI Learning
Use these prompts to test your understanding after completing the exercise. Direct the AI - do not let it do the exercise for you.
App: Do the fit visually with the TCLab Simulation Studio - record a step test, choose the first-order model, and move the Kp, tau-p, and theta-p sliders until the prediction matches the data; the live objective shows the quality of your graphical fit.
What to Turn In
Submit a short report (PDF, 1-2 pages) that curates your results into a demonstration of what you learned. You may use Generative AI to help write the report, but you must guide it to the correct visualizations, justifications, and assumptions. Answer these questions:
- Include your annotated step-test plot showing delta-y, delta-u, the 63.2% point, and the dead time. Report Kp, tau-p, and theta-p with units.
- Show the same fit from the app sliders. How close are the graphical values and the slider values, and which parameter was hardest to pin down?
- What would each parameter do (increase/decrease/unchanged) if you repeated the test at a lower ambient temperature? Justify.
- From the quiz prompt: one question you missed and the corrected answer.



