Documentation |
The structure of a process model is a simple continuous-time transfer function that describes linear system dynamics in terms of one or more of the following elements:
Static gain K_{p}.
One or more time constants T_{pk}. For complex poles, the time constant is called $${T}_{\omega}$$—equal to the inverse of the natural frequency—and the damping coefficient is $$\zeta $$ (zeta).
Process zero T_{z}.
Possible time delay T_{d} before the system output responds to the input (dead time).
Possible enforced integration.
Process models are popular for describing system dynamics in many industries and apply to various production environments. The advantages of these models are that they are simple, support transport delay estimation, and the model coefficients have an easy interpretation as poles and zeros.
You can create different model structures by varying the number of poles, adding an integrator, or adding or removing a time delay or a zero. You can specify a first-, second-, or third-order model, and the poles can be real or complex (underdamped modes).
For example, the following model structure is a first-order continuous-time process model, where K is the static gain, T_{p1} is a time constant, and T_{d} is the input-to-output delay:
$$G(s)=\frac{{K}_{p}}{1+s{T}_{p1}}{e}^{-s{T}_{d}}$$
You can estimate low-order (up to third order), continuous-time transfer functions using regularly sampled time- or frequency-domain iddata or idfrd data objects. The frequency-domain data may have a zero sample time.
You must import your data into the MATLAB^{®} workspace, as described in Data Preparation.
Before you can perform this task, you must have
Imported data into the System Identification app. See Import Time-Domain Data into the App. For supported data formats, see Data Supported by Process Models.
Performed any required data preprocessing operations. If you need to model nonzero offsets, such as when model contains integration behavior, do not detrend your data. In other cases, to improve the accuracy of your model, you should detrend your data. See Ways to Prepare Data for System Identification.
In the System Identification app, select Estimate > Process models to open the Process Models dialog box.
To learn more about the options in the dialog box, click Help.
If your model contains multiple inputs, select the input channel in the Input list. This list only appears when you have multiple inputs. For more information, see Estimating Multiple-Input, Multi-Output Process Models.
In the Model Transfer Function area, specify the model structure using the following options:
Under Poles, select the number of poles, and then select All real or Underdamped.
Select the Zero check box to include a zero, which is a numerator term other than a constant, or clear the check box to exclude the zero.
Select the Delay check box to include a delay, or clear the check box to exclude the delay.
Select the Integrator check box to include an integrator (self-regulating process), or clear the check box to exclude the integrator.
The Parameter area shows as many active parameters as you included in the model structure.
Note: By default, the model Name is set to the acronym that reflects the model structure, as described in Process Model Structure Specification. |
In the Initial Guess area, select Auto-selected to calculate the initial parameter values for the estimation. The Initial Guess column in the Parameter table displays Auto. If you do not have a good guess for the parameter values, Auto works better than entering an ad hoc value.
(Optional) If you approximately know a parameter value, enter this value in the Initial Guess column of the Parameter table. The estimation algorithm uses this value as a starting point. If you know a parameter value exactly, enter this value in the Initial Guess column, and also select the corresponding Known check box in the table to fix its value.
If you know the range of possible values for a parameter, enter these values into the corresponding Bounds field to help the estimation algorithm.
For example, the following figure shows that the delay value Td is fixed at 2 s and is not estimated.
In the Disturbance Model list, select one of the available options. For more information about each option, see Disturbance Model Structure for Process Models.
In the Focus list, select how to weigh the relative importance of the fit at different frequencies. For more information about each option, see Assigning Estimation Weightings.
In the Initial state list, specify how you want the algorithm to treat initial states. For more information about the available options, see Specifying Initial Conditions for Iterative Estimation Algorithms.
In the Covariance list, select Estimate if you want the algorithm to compute parameter uncertainties. Effects of such uncertainties are displayed on plots as model confidence regions.
To omit estimating uncertainty, select None. Skipping uncertainty computation might reduce computation time for complex models and large data sets.
In the Model Name field, edit the name of the model or keep the default. The name of the model should be unique in the Model Board.
To view the estimation progress, select the Display Progress check box. This opens a progress viewer window in which the estimation progress is reported.
Click Regularization to obtain regularized estimates of model parameters. Specify the regularization constants in the Regularization Options dialog box. To learn more, see Regularized Estimates of Model Parameters.
Click Estimate to add this model to the Model Board in the System Identification app.
To stop the search and save the results after the current iteration has been completed, click Stop Iterations. To continue iterations from the current model, click the Continue button to assign current parameter values as initial guesses for the next search.
Validate the model by selecting the appropriate check box in the Model Views area of the System Identification app. For more information about validating models, see Validating Models After Estimation.
Refine the model by clicking the Value —> Initial Guess button to assign current parameter values as initial guesses for the next search, edit the Name field, and click Estimate.
Export the model to the MATLAB workspace for further analysis by dragging it to the To Workspace rectangle in the System Identification app.
Before you can perform this task, you must have
Input-output data as an iddata object or frequency response data as frd or idfrd objects. See Representing Time- and Frequency-Domain Data Using iddata Objects. For supported data formats, see Data Supported by Process Models.
Performed any required data preprocessing operations. When working with time domain data, if you need to model nonzero offsets, such as when model contains integration behavior, do not detrend your data. In other cases, to improve the accuracy of your model, you should detrend your data. See Ways to Prepare Data for System Identification.
You can estimate process models using the iterative estimation method procest that minimizes the prediction errors to obtain maximum likelihood estimates. The resulting models are stored as idproc model objects.
You can use the following general syntax to both configure and estimate process models:
m = procest(data,mod_struc,opt)
data is the estimation data and mod_struc is one of the following:
A string that represents the process model structure, as described in Process Model Structure Specification.
A template idproc model. opt is an option set for configuring the estimation of the process model, such as handling of initial conditions, input offset and numerical search method.
Tip You do not need to construct the model object using idproc before estimation unless you want to specify initial parameter guesses, minimum/maximum bounds, or fixed parameter values, as described in Estimate Process Models with Fixed Parameters. |
For more information about validating a process model, see Validating Models After Estimation.
You can use procest to refine parameter estimates of an existing process model, as described in Refining Linear Parametric Models.
For detailed information, see procest and idproc.
This example shows how to estimate the parameters of a first-order process model:
This process has two inputs and the response from each input is estimated by a first-order process model. All parameters are free to vary.
load co2data % Sampling interval is 0.5 min (known) Ts = 0.5; % Split data set into estimation data ze and validation data zv ze = iddata(Output_exp1,Input_exp1,Ts,... 'TimeUnit','min'); zv = iddata(Output_exp2,Input_exp2,Ts,... 'TimeUnit','min');
Estimate model with one pole, a delay, and a first-order disturbance component. The data contains known offsets. Specify them using the InputOffset and OutputOffset options.
opt = procestOptions; opt.InputOffset = [170;50]; opt.OutputOffset = -45; opt.Display = 'on'; opt.DisturbanceModel = 'arma1'; m = procest(ze,'p1d',opt)
m = Process model with 2 inputs: y = G11(s)u1 + G12(s)u2 From input "u1" to output "y1": Kp G11(s) = ---------- * exp(-Td*s) 1+Tp1*s Kp = 2.6542 Tp1 = 0.15451 Td = 2.3185 From input "u2" to output "y1": Kp G12(s) = ---------- * exp(-Td*s) 1+Tp1*s Kp = 9.9754 Tp1 = 2.0653 Td = 4.9195 An additive ARMA disturbance model exists for output "y1": y = G u + (C/D)e C(s) = s + 2.677 D(s) = s + 0.6237 Parameterization: 'P1D' 'P1D' Number of free coefficients: 8 Use "getpvec", "getcov" for parameters and their uncertainties. Status: Estimated using PROCEST on time domain data "ze". Fit to estimation data: 91.07% (prediction focus) FPE: 2.431, MSE: 2.412
Use dot notation to get the value of any model parameter. For example, get the value of dc gain parameter Kp .
m.Kp
ans = 2.6542 9.9754
This example shows how to estimate a process model with fixed parameters.
When you know the values of certain parameters in the model and want to estimate only the values you do not know, you must specify the fixed parameters after creating the idproc model object. Use the following commands to prepare the data and construct a process model with one pole and a delay:
% Load data load co2data % Sampling interval is 0.5 min (known) Ts = 0.5; % Split data set into estimation data ze and validation data zv ze = iddata(Output_exp1,Input_exp1,Ts,... 'TimeUnit','min'); zv = iddata(Output_exp2,Input_exp2,Ts,... 'TimeUnit','min'); mod = idproc({'p1d','p1d'},'TimeUnit','min')
mod = Process model with 2 inputs: y = G11(s)u1 + G12(s)u2 From input 1 to output 1: Kp G11(s) = ---------- * exp(-Td*s) 1+Tp1*s Kp = NaN Tp1 = NaN Td = NaN From input 2 to output 1: Kp G12(s) = ---------- * exp(-Td*s) 1+Tp1*s Kp = NaN Tp1 = NaN Td = NaN Parameterization: 'P1D' 'P1D' Number of free coefficients: 6 Use "getpvec", "getcov" for parameters and their uncertainties. Status: Created by direct construction or transformation. Not estimated.
The model parameters Kp , Tp1 , and Td are assigned NaN values, which means that the parameters have not yet been estimated from the data.
Use the Structure model property to specify the initial guesses for unknown parameters, minimum/maximum parameter bounds and fix known parameters.
Set the value of Kp for the second transfer function to 10 and specify it as a fixed parameter. Initialize the delay values for the two transfer functions to 2 and 5 minutes, respectively. Specify them as free estimation parameters.
mod.Structure(2).Kp.Value = 10; mod.Structure(2).Kp.Free = false; mod.Structure(1).Tp1.Value = 2; mod.Structure(2).Td.Value = 5;
Estimate Tp1 and Td only.
mod_proc = procest(ze, mod)
mod_proc = Process model with 2 inputs: y = G11(s)u1 + G12(s)u2 From input "u1" to output "y1": Kp G11(s) = ---------- * exp(-Td*s) 1+Tp1*s Kp = -3.2213 Tp1 = 2.522 Td = 3.8285 From input "u2" to output "y1": Kp G12(s) = ---------- * exp(-Td*s) 1+Tp1*s Kp = 10 Tp1 = 2.4382 Td = 4.111 Parameterization: 'P1D' 'P1D' Number of free coefficients: 5 Use "getpvec", "getcov" for parameters and their uncertainties. Status: Estimated using PROCEST on time domain data "ze". Fit to estimation data: 71.66% FPE: 24.42, MSE: 24.3
In this case, the value of Kp is fixed, but Tp1 and Td are estimated.
This topic describes how to specify the model structure in the estimation procedures Estimate Process Models Using the App and Estimate Process Models at the Command Line.
In the System Identification app. Specify the model structure by selecting the number of real or complex poles, and whether to include a zero, delay, and integrator. The resulting transfer function is displayed in the Process Models dialog box.
At the command line. Specify the model structure using an acronym that includes the following letters and numbers:
(Required) P for a process model
(Required) 0, 1, 2 or 3 for the number of poles
(Optional) D to include a time-delay term $${e}^{-s{T}_{d}}$$
(Optional) Z to include a process zero (numerator term)
(Optional) U to indicate possible complex-valued (underdamped) poles
(Optional) I to indicate enforced integration
Typically, you specify the model-structure acronym as a string argument in the estimation command procest:
procest(data,'P1D') to estimate the following structure:
$$G(s)=\frac{{K}_{p}}{1+s{T}_{p1}}{e}^{-s{T}_{d}}$$
procest(data,'P2ZU') to estimate the following structure:
$$G(s)=\frac{{K}_{p}\left(1+s{T}_{z}\right)}{1+2s\zeta {T}_{w}+{s}^{2}{T}_{w}^{2}}$$
procest(data,'P0ID') to estimate the following structure:
$$G(s)=\frac{{K}_{p}}{s}{e}^{-s{T}_{d}}$$
procest(data,'P3Z') to estimate the following structure:
$$G(s)=\frac{{K}_{p}\left(1+s{T}_{z}\right)}{\left(1+s{T}_{p1}\right)\left(1+s{T}_{p2}\right)\left(1+s{T}_{p3}\right)}$$
For more information about estimating models, see Estimate Process Models at the Command Line.
If your model contains multiple inputs, multiple outputs, or both, you can specify whether to estimate the same transfer function for all input-output pairs, or a different transfer function for each. The information in this section supports the estimation procedures Estimate Process Models Using the App and Estimate Process Models at the Command Line.
In the System Identification app. To fit a data set with multiple inputs, or multiple outputs, or both, in the Process Models dialog box, configure the process model settings for one input-output pair at a time. Use the input and output selection lists to switch to a different input/output pair.
If you want the same transfer function to apply to all input/output pairs, select the All same check box. To apply a different structure to each channel, leave this check box clear, and create a different transfer function for each input.
At the command line. Specify the model structure as a cell array of acronym strings in the estimation command procest. For example, use this command to specify the first-order transfer function for the first input, and a second-order model with a zero and an integrator for the second input:
m = idproc({'P1','P2ZI'}) m = procest(data,m)
To apply the same structure to all inputs, define a single structure in idproc.
This section describes how to specify a noise model in the estimation procedures Estimate Process Models Using the App and Estimate Process Models at the Command Line.
In addition to the transfer function G, a linear system can include an additive noise term He, as follows:
$$y=Gu+He$$
where e is white noise.
You can estimate only the dynamic model G, or estimate both the dynamic model and the disturbance model H. For process models, H is a rational transfer function C/D, where the C and D polynomials for a first- or second-order ARMA model.
In the app. To specify whether to include or exclude a noise model in the Process Models dialog box, select one of the following options from the Disturbance Model list:
None — The algorithm does not estimate a noise model (C=D=1). This option also sets Focus to Simulation.
Order 1 — Estimates a noise model as a continuous-time, first-order ARMA model.
Order 2 — Estimates a noise model as a continuous-time, second-order ARMA model.
At the command line. Specify the disturbance model using the procestOptions option set. For example, use this command to estimate a first-order transfer function and a first-order noise model:
opt = procestOptions; opt.DisturbanceModel = 'arma1'; model = procest(data, 'P1D', opt);
For a complete list of values for the DisturbanceModel model property, see the procestOptions reference page.
You can specify how the estimation algorithm weighs the fit at various frequencies. This information supports the estimation procedures Estimate Process Models Using the App and Estimate Process Models at the Command Line.
In the System Identification app. Set Focus to one of the following options:
Prediction — Uses the inverse of the noise model H to weigh the relative importance of how closely to fit the data in various frequency ranges. Corresponds to minimizing one-step-ahead prediction, which typically favors the fit over a short time interval. Optimized for output prediction applications.
Simulation — Uses the input spectrum to weigh the relative importance of the fit in a specific frequency range. Does not use the noise model to weigh the relative importance of how closely to fit the data in various frequency ranges. Optimized for output simulation applications.
Stability — Behaves the same way as the Prediction option, but also forces the model to be stable. For more information about model stability, see Unstable Models.
Filter — Specify a custom filter to open the Estimation Focus dialog box, where you can enter a filter, as described in Simple Passband Filter or Defining a Custom Filter. This prefiltering applies only for estimating the dynamics from input to output. The disturbance model is determined from the estimation data.
At the command line. Specify the focus using the procestOptions option set. For example, use this command to optimize the fit for simulation and estimate a disturbance model:
opt = procestOptions('DisturbanceModel','arma2', 'Focus','simulation'); model = procest(data, 'P1D', opt);
You can optionally specify how the iterative algorithm treats initial conditions for estimation of model parameters. This information supports the estimation procedures Estimate Process Models Using the App and Estimate Process Models at the Command Line.
In the System Identification app. Set Initial condition to one of the following options:
Zero — Sets all initial states to zero.
Estimate — Treats the initial states as an unknown vector of parameters and estimates these states from the data.
Backcast — Estimates initial states using a backward filtering method (least-squares fit).
U-level est — Estimates both the initial conditions and input offset levels. For multiple inputs, the input level for each input is estimated individually. Use if you included an integrator in the transfer function.
Auto — Automatically chooses one of the preceding options based on the estimation data. If the initial conditions have negligible effect on the prediction errors, they are taken to be zero to optimize algorithm performance.
At the command line. Specify the initial conditions using the InitialCondition model estimation option, configured using the procestOptions command. For example, use this command to estimate a first-order transfer function and set the initial states to zero:
opt = procestOptions('InitialCondition','zero'); model = procest(data, 'P1D', opt)