This library implements a gradient-approach to fit a first-order plus deadtime (FOPDT) model to input and output data. Specifically, it fits the following model
Where
-
$\tau$ = process time constant -
$K$ = process gain -
$\theta$ = process dead time
- Numpy
- Scipy (for simulation and filtering in the example)
- Matplotlib (for plotting)
- FOPDT_fitter.py contains the library for model fitting.
- example.ipynb shows and example using the library.
To library can be used the following way:
# import the library
import FOPDT_fitter
# initial guess of parameters
tua_0 = 1
K_0 = 0.5
theta_0 = 0
# call the fit_model function with initial guess,
# and input, output and time vector
tua, K, theta = FOPDT_fitter.fit_model(tua_0, K_0, theta_0, u, y, t)The graph below shows the result of the example. The blue line is the input signal 
The library makes use of the Gauss–Newton algorithm to solve a non-linear least squares problem in which the residuals are penalized. A backtracking line search is implemented as a globalization strategy.
Because it is a gradient based algorithm, the library is sensitive to the initial guess. It is therefore recommended using a good initial guess. Also, as shown in the example, the algorithm is sensitive to noise in the data. Therefore, it is recommended to filter the data before fitting the model.
- Expanding it to multiple inputs.