The Fuzzy-Predictive-Control repository is a comprehensive collection of Python Jupyter Notebooks that demonstrate the implementation of fuzzy modeling and predictive functional control techniques.
The fuzzy-predictive-control repository aims to support control engineers, researchers, and students in their pursuit of mastering advanced control techniques. The notebooks contain well-commented code examples, insightful visualizations, and comprehensive explanations to ensure a productive and educational learning experience. Whether you are a beginner or have some experience in control systems, these tutorials will help you enhance your control engineering skills and broaden your understanding of advanced control methodologies.
Notebook basics.ipynb
serves as a foundational guide to basic modeling techniques for first-order dynamic systems. It covers essential concepts such as system identification, parameter estimation, and system response analysis. The notebook aims to build a strong understanding of the fundamental principles that underpin more sophisticated control strategies.
Focused on fuzzy (Takagi-Sugeno) modeling and predictive functional control, fuzzy_control.ipynb
notebook presents a comprehensive approach to controlling the Helicrane system. It takes you through a series of well-structured steps, including:
Static Characteristics: Analyzing the Helicrane's static behavior to gain insights into its characteristics.
We perform excitation of the system at different operational points on a scale and obtain process outputs.
Obtaining process static characteristics - experiment. |
Based on these outputs, we construct the static characteristic, illustrating the input-output relationship in a steady state
Process static characteristics. |
Fuzzy Clustering (Gustafson-Kessel): Implementing fuzzy clustering to partition data and generate fuzzy sets.
The Gustafson-Kessel method introduces a variable covariance matrix for each cluster and thus a concrete improves the detection of different cluster shapes in the dataset. In our case, we used it to identify local linear regions in the static characteristic of the process, in which we identified local linear models.
Process static characteristics - clusters and covariance matrices. |
Based on the clusters detected in the static characteristic, we calculate membership functions describing the membership of the current state of the model to individual linear regions of the process.
Membership Functions are normalised Gaussian functions:
where:
where:
-
$M$ : The number of LLM (Local Linear Model) instances. -
$p$ : The number of parameters determining the memebership function. -
$u_j$ : The value of the j-th element in the regressor matrix. -
$c_i$ : The center of the i-th cluster. -
$\gamma$ : The fuzziness coefficient used in the algorithm. -
$\sigma_{ij}$ : The standard deviation.
Membership functions. |
Local Linear Model Identification: Identifying local linear models to approximate the Helicrane's nonlinear behavior.
Estimating the local linear parameters of the model involves a linear optimization problem, assuming that the validity functions are known, which is the case in our study.
There are two approaches to parameter estimation:
- Global estimation: Considers the model as a whole.
- Local estimation: Considers only the local characteristics of the model.
In our case, we employed the local estimation approach due to its advantages over global estimation, such as reduced complexity and well-conditioned regressor matrices. The notable advantage of local estimation is its improved interpretability, which is crucial for identification purposes. However, this comes at the cost of increased bias.
The local estimation is performed separately for each local model, typically using methods like the least squares method.
The general transfer function sought in parametric identification is given as:
To cover the entire operating range of the process, an pseudo-random binary signal (PRBS) was used as the excitation signal, with appropriate intervals for changing the amplitude (based on the dominant time constant of the process).
We construct the matrix
The matrix
We calculate the model parameters
Alternatively, parameter estimation with the method of weighted least squares (excitation with APRBS) is possible, where the weights in the diagonal matrix
- Fuzzy model can be simulated to observe its response to various inputs.
- One-Step Ahead Prediction method can be also used to predict the system's future behavior using the fuzzy model.
Predictive Functional Controller (PFC): Designing a PFC for reference tracking and disturbance rejection in the Helicrane system.
In the case of controlling higher-order multivariable processes, it is more convenient to represent the model in the state-space form rather than using a transfer function. Thus, we focus on the following state-space representation:
In real processes, where there is no direct influence of input signals on outputs, the term
In our case, where a soft model composed of multiple locally linear models is used, we express the model in the Observable Canonical State Space (OCSS) form:
where:
Here,
Steady-state can be modelled as shown in the above equation, in the last row. This is denoted by
During the implementation of PFC, a reference model trajectory is also modeled to represent the desired reference change (usually a first-order model). This reference model should have unity gain, meaning that the matrices
After the derivation, we obtain the simplified control law:
where:
and:
Here,
As mentioned earlier, it is necessary to first define the reference trajectory model, which, in our case, is a first-order model. The system matrix
The control is performed in the following sequence. First:
-
Select the reference signal.
-
Choose the dynamics of the reference generator and calculate matrices
$\mathbf{A}_r$ ,$\mathbf{B}_r$ , and$\mathbf{C}_r$ . -
Set initial states of the models and ensure the initial state of the process or adapt the model states to the current process state. Then, in a loop:
-
Calculate the memberships
$\mathbf{\beta}$ of LLM. -
Calculate the output of the reference model and update the model states.
-
Calculate the output of the process model and update the model states.
-
Measure the process output.
-
Calculate the control variable for the next step.
-
Limit the calculated control variable according to actuator constraints.
-
Apply the control variable to the process.
The control strategy can be broadly divided into reference tracking and disturbance rejection operations.
During reference tracking, the goal is to achieve better tracking of the process output to the reference signal.
Reference tracking. |
While disturbance rejection, the aim is to minimize the effects of external disturbances at a constant reference.
Disturbance rejection. |
Through this notebook, you will gain practical experience in applying advanced control strategies, with a specific focus on fuzzy logic and predictive control techniques. The presented techniques can be applied to other complex systems and real-world scenarios.