The Model

FOPTD model is also called TDTC (Time Delay Time Constant) model. The general form is:

$$ \begin{equation} \frac{T(s)}{U(s)}=\frac{K_{ss}}{\tau s+1}e^{-s\theta} \end{equation} $$

where $K_{ss}$ is the steady-state gain, $\tau$ is the time constant, and $\theta$ is the time delay. Here, our task is to find $K_{ss}$, $\tau$, and $\theta$ from the collected data. $T(s)$ and $U(s)$ are the device temperature ($^{\circ}C$) and the applied input (PWM), respectively.


Collecting Step-Response Data

Although we have two heaters with two temperature sensors, we will use only one of the heaters for this section.

  1. Load the following Simulink file (MATLAB R2022a, the R2018b-file is untested) :

    fopdt_2018b.slx

    fopdt_2022a.slx

  2. Set the input of the heater 1 ($u_1$) to 0.3 (30% PWM).

Fig. 1 The basic Simulink diagram. We will only use “Heater 1” and “T1”.

Fig. 1 The basic Simulink diagram. We will only use “Heater 1” and “T1”.

  1. Run the simulation for about 3000 seconds (or until it reaches its steady-state temperature).

  2. Stop the simulation, and check the logged data in: datalog.mat. See the following as an example:

    datalog.mat

  3. Plot the data using these lines of codes:

clc
clear 
close all

load datalog.mat

t  = datalog(1, :);
u1 = datalog(2, :);
u2 = datalog(3, :);
T1 = datalog(4, :);
T2 = datalog(5, :);

figure
subplot(2,1,1)
hold on
plot(t, T1)
plot(t, T2)
legend('$T_1$','$T_2$', 'interpreter', 'latex', 'location', 'best')
xlabel('Time (s)')
title('Outputs')

subplot(2,1,2)
hold on
plot(t, u1)
plot(t, u2)
legend('$u_1$','$u_2$', 'interpreter', 'latex', 'location', 'best')
xlabel('Time (s)')
title('Inputs')

%% Plot only T1, we don't care about T2
figure
plot(t, T1)
xlabel('Time (s)')
title('$T_1$', 'Interpreter','latex')
ylim([0 80])

%% Plot cleaned T1 where we removed the room temperature from the data
offset = datalog(3,1); % the first data point is the room temperature
T1_cleaned = T1 - offset;
figure
plot(t, T1_cleaned)
xlabel('Time (s)')
title('Cleaned $T_1$', 'Interpreter','latex')

Fig. 2 The collected step-response data that we will use for system identification.

Fig. 2 The collected step-response data that we will use for system identification.


Parameter Estimation by Graphic Fitting

Load datalog.mat to MATLAB’s workspace and open it. The first row is the time stamp, the second row is the first input $(u_1)$ and the fourth row is the first output $(T_1)$. We ignore the second input and output.