Methods and Algorithms For Advanced Process Control
Methods and Algorithms For Advanced Process Control
We know that for continuous systems the transmission matrix is zero in practice. Therefore
our direct transmission matrix will be equal to D = [0 0]T .
We can now perform an open loop analysis of the model. The system has 4 poles at s =
2.96, −1.531 ± 0.5115i, −16.7635 (fig. 1). It is evident and also matches with our intuition, that
the system is unstable, as it has a pole with positive real value. The rank of the controllability
matrix C = [B, AB, A2 B ... An−1 B], is 4, equal to the order of the system, thus the system is
controllable, and therefore stabilizable. Correspondingly, the rank of the observability matrix
is O = [C, CA, CA2 ... CAn−1 ]T and thus the system is observable, and also detectable. Since
the system is observable and controllable, the realization is minimal. Finally, we note that the
system has no transmission zeros.
Our goal will be to control the cart’s position so that the seesaw balances at a given (small)
angle, an equilibrium which as we saw is unstable. In other words, we are looking to stabilize the
system at the given reference angle.
2
2 LQR Design - First Closed-Loop Diagram
For our first approach, we will make a simplified closed-loop diagram, shown in fig. 2. According
to this approach the controller has direct access to the full state x.
1 0 0 0
0 40000 0 0
Q=
, R=10.
0 0 0 0
0 0 0 0
3
Figure 3: Step response & control inputs for initial Q and R matrices
Figure 4: Step response & control inputs for chosen Q and R matrices
Our closed-loop system has poles at s = −16.69, −3.517 ± 4.317i, −5.2358 . As expected, all
poles lie on the left half of the complex plane, thus the closed loop system is stable (fig 6).
4
Figure 6: Poles for the closed-loop system.
i. As in the original diagram, we have an input reference signal, a calculated steady state and
steady state input. We have included the effect of a saturator on the input voltage (the
magnitude of all inputs is cut off at 5V ). Additionally, the state space model’s output matrix
is not the identity as before. The only outputs are now the position and angle.
ii. Here we simulate the measurement process of the two outputs; since we don’t have any access
to the laboratory equipment, we just assume that our output signal is affected by a noise source
of power equal to 10−7 . This amounts to disturbances of 0.01 meters and radians, respectively
for the position and angle. This noisy signal is then translated by the potentiometer into a
voltage value via a linear relationship (as long as it’s within the limits of ±0.456m and ±15o ),
and digitized by an A/D converter. We translated the digitization process into Simulink in the
following way: first we discretized the interval [−10, 10] in 65536 possible values, as this is the
resolution of the 16-bit converter. Then we pinpointed exactly where the meaningful values
for our variables lie in this discretized interval (they are ±4.41V and ±3.166V for position
and angle respectively). Dividing the range of our meaningful values (in engineering units),
5
by the length of the ”acceptable” values vector minus one, we get the quantization interval
for each component of the signal. This is approx. equal to 3.156 · 10−5 m for the position and
2.5235 · 10−5 rad for the angle.
iii. After position and angle have been measured, an estimation for velocity and angular velocity
must be made; this is done by cooperation of a memory block with the low-pass filter gains.
The processed signal at time k is a linear combination of the value of the filtered signal at
time k − 1, and the raw signal at time k: ykf = 1+ω
ωc T s
cT s
f
yk + 1+ω1c T s yk−1 . Here ωc is the cutoff
frequency in radians per second of our filter. Consequently, the rates of change of the signals
f f
yk −yk−1
are computed from the filtered values with a backward difference formula: ẏ = Ts . The
estimated state is thus fed back into the controller as before.
We tested the system’s response to a reference input of 3.5 degrees, as before. The results
can be seen in fig. 8. Evidently, the addition of noise isn’t handled very well by the system. It
does of course settle around the desired equilibrium, yet the controller is very nervous. Playing
around with the Q and R matrices didn’t help with the system’s behaviour either. Finally, we also
attempted to feed the post-filter signal of position and velocity back to the controller, instead of
the unfiltered one. This led to only slightly less nervous response in the control action.
Figure 8: Step response & control inputs for a low-pass filter cutoff frequency of 2Hz.
Figure 9: Step response & control inputs for a low-pass filter cutoff frequency of 1Hz.
6
Figure 10: Step response for a low-pass filter cutoff frequency of 50Hz.
The diagrams above also show the system’s behaviour for different values of the cut-off fre-
quency. We can see that the system’s dynamics can be heavily influenced by the cut-off frequency,
and it may even become unstable. Therefore a balance has to be maintained. If we set the cut-off
frequency too high, we are inviting a lot of noise into our signal, and thus increasing the error in
the estimation of the derivative. On the other hand, setting wc too low essentially means that
a significant part of the actual system dynamics will be filtered away, thus again increasing the
error.
4 Experimental Results
Having completed the closed loop diagram we can pair it to our experimental setup’s controller.
This is shown in the third and final Simulink diagram of fig. 11. Admittedly, it is a bit tangled.
The basic difference is that here we don’t have to simulate the measurement process of x and θ.
Those are given by the actual potentiometer and A/D converter. Given the raw signal the model
proceeds to filter it, estimate the velocities and calculate the corresponding gain as before. There
is also an additional saturation at 3.5V right before the input is set to the controller (because of
this perhaps we should reconsider the control action penalty in our LQR controller).
Unfortunately, this year’s circumstances did not allow for ”eating the pudding”, i.e. testing
our model in the lab by performing a real-time physical experiment.
7
5 Conclusion
In this practicum we studied the implementation of a controller for a relatively simple physical
mechanism. The project allowed us to see how even this simple setup has many subtle details that
have to be addressed in order to achieve robust and effective control. We began by coding a state
space model for a linearized version of our system, and studying its dynamics. We then added
state feedback to our system, by investigating the options given by the LQR methodology. This
led to the creation of a stable closed-loop system. We proceeded by expanding this model, taking
into account the measurement and digitization process of the output variables, and the filtering
that is necessary for signal processing and estimation of the full state. We saw how seriously this
filtering process can affect the performance of our controller. Overall, the project served as an
enlightening example of how a digital controller based on a continuous model is built.