Import Measured Response Data for Plant Estimation
This example shows how to use PID Tuner to import measured response data for plant estimation.
If you have System Identification Toolbox™ software, you can use PID Tuner to estimate the parameters of a linear plant model based on time-domain response data. PID Tuner then tunes a PID controller for the resulting estimated model. The response data can be either measured from your real-world system, or obtained by simulating your Simulink® model. Plant estimation is especially useful when your Simulink model cannot be linearized or linearizes to zero. For plant identification, you must specify a finite value for the Simulink model stop time.
Load Measured Response Data
Load the measured response data for this example into the MATLAB® workspace.
load PIDPlantMeasuredIOData
When you import response data, PID Tuner assumes that your measured data represents a plant connected to the PID controller in a negative-feedback loop. In other words, PID Tuner assumes the following structure for your system. PID Tuner assumes that you injected a step signal at the plant input u and measured the system response at y, as shown.
The sample data file for this example, contains three variables, each of which is a 501-by-1 array. inputu
is the unit step function injected at u
to obtain the response data. outputy
is the measured response of the system at y
. The time vector t
, runs from 0 to 50 s with a 0.1 s sample time. Comparing inputu
to t shows that the step occurs at t
= 5 s.
You can import response data stored as a numeric array (as in this example), a timeseries
object, or an iddata
object.
Import Response Data
Open PID Tuner.
pidTuner(tf(1),'PI');
In PID Tuner, in the PID Tuner tab, in the Plant menu, select
Identify New Plant
.In the Plant Identification tab, click Get I/O data. Select the type of measured response data you have. For example, if you measured the response of your plant to a step input, select Step Response. To import the response of your system to an arbitrary stimulus, select Arbitrary I/O Data.
In the Import Step Response dialog box, enter information about your response data. For example, for step-response data stored in a variable
outputy
and sampled every 0.1s:Click Import. The Plant Identification tab opens, displaying the response data and the response of an initial estimated plant.
Preprocess Data
Depending on the quality and features of your response data, you might want to perform some preprocessing on the data to improve the estimated plant results. The Preprocess menu gives you several options for preprocessing response data, such as removing offsets, filtering, or extracting on a subset of the data. In particular, when the response data has an offset, it is important for good identification results to remove the offset.
In the Plant Identification tab, click Preprocess and select the preprocessing option you want to use. A tab opens with a figure that displays the original and preprocessed data. Use the options in the tab to specify preprocessing parameters.
(For more information about preprocessing options, see Preprocess Data.)
When you are satisfied with the preprocessed signal, click Update to save the change to the signal. Click to return to the Plant Identification tab.
PID Tuner automatically adjusts the plant parameters to create a new initial guess for the plant based on the preprocessed response signal.
You can now adjust the structure and parameters of the estimated plant to obtain the estimated linear plant model for PID Tuning. See Interactively Estimate Plant from Measured or Simulated Response Data for more information.