AnalogModalControlWithKalmanBucy

Modal Synthesis Method for Control Systems with an Example. C Code and Octave Script

1. Abbreviation

MC_formula1_6

2. Introduction

The modal synthesis method is based on the selection of suitable roots of a characteristic linear differential equation for a closed loop control system, which provide the necessary transition process in the system. The choice of roots determines the control system’s own motions and provides the necessary working out of the initial conditions. The article is based on the [1]: A. S. Vostrikov, G. A. Francuzova “Theory of automatic regulation”. The method is used for linear control systems.
Figure 2-1 shows an Analog Modal Control System:

AnalogModalControl

Figure 2-1: Analog Modal Control System

where
x(t) – input signal / required value
u(t) – object control
y(t) – output signal / measured value
MC_formula7_10
Let’s write down the closed system Laplace transfer function for Figure 2-1:

MC_formula11

Then the characteristic equation of the differential equation:

MC_formula12_13

By selecting the values:

MC_formula14

we will get the necessary roots:

MC_formula15

of the characteristic equation (13). To avoid overshooting, only real roots will be used.
If m < (n-1) (16) then the Laplace transfer function of the dynamic correction (10) has a numerator degree greater than the degree of the denominator, which leads to a rise in the upper frequencies in the feedback. To reduce this effect, it is recommended to use Kalman-Bucy filter in [1]. See the Figure 2-2:
AnalogKalmanBucyFilter

Figure 2-2: Analog Kalman-Bucy Filter

Stable correction: Hsc(s) is selected in such a way that transients in the Kalman-Bucy filter was an order of magnitude faster than in the control system:

MC_formula17

In this case the control system will take the form shown in Figure 2-3:

AnalogModalControlWithKalmanBucy

Figure 2-3: Analog Modal Control System with the Kalman-Bucy Filter

Note
If the control object is unstable, then with the using of Kalman-Bucy Filter, the stability of the system can be achieved

3. Analog Example

Let there be a second-order control object described by a Laplace transfer function:

MC_formula18_21

Note
The description of the quality factor was done in the article: “Digital Derivative Filter Using Integrators. C Code and Octave Script”
The step response of the object is shown in Figure 3-1:

AnalogObjectStepResponse

Figure 3-1: Step Response on the Control Object without Regulator

Choosing the real roots (15) of the characteristic equation, we can write:

MC_formula22

Let’s rewrite (13) for our example:

MC_formula23_24

Comparing (22) and (24), we get:

MC_formula24_1

Then:

MC_formula25

We will choose the values:
MC_formula25_1
based on the requirements for the transient process, for example: tp = 0.5s.
In the article “Non-Causal Digital Chebyshev Filter with Linear Phase Response. C Implementation and Octave Script.” for a Laplace transfer function:
MC_formula26
the formula for calculating the generalized tau was proved:

MC_formula27

Applying the (27) to the (11) and using the (22):

MC_formula28

If root values are selected:

MC_formula29

Then from (28) and (29):

MC_formula29_1

Now let’s use the rule of the three tau for the transient process:

MC_formula29_2

Thus in order to provide the necessary transient process, it is necessary to choose the roots of the characteristic equation according to the formula:

MC_formula30

Let’s set the time of the transient process in the control system:

MC_formula31

Then by the formula (30):

MC_formula32

From (32) roots will be choosed:

MC_formula33

Now the values of Ki, Kd, d1 are calculated for our example using (25):

MC_formula34

Thus:

MC_formula35_37

The Step Response of the control system is shown in Figure 3-2:

AnalogModalStepResponse

Figure 3-2: Step Response of the Analog Modal Control System (37)

Since the degree of the numerator is greater than the degree of the denominator in (36), it is necessary to apply the Kalman-Bucy Filter (see also the (16)). To design this filter, we also use the modal method using (17), (30), (31):

MC_formula38_39

Laplace transfer function of the Kalman-Bucy filter from Figure 2-2:

MC_formula40

Note for (40):

MC_formula40ab

The stable correction Hsc(s) will be searched in the form:

MC_formula41

Then:

MC_formula42

The characteristic equation for Kalman-Bucy filter will take the form:

MC_formula43

For our example (18), the characteristic equation for Kalman-Bucy filter will be written:

MC_formula43_1

Then:

MC_formula44

Now from (39) the roots of the characteristic equation are selected:

MC_formula45

Then:

MC_formula46

Comparing (44a) and (46), we get:

MC_formula47

Solving (47) with respect to T1, T2, Ksc, we obtain:

MC_formula48_50

For our example:

MC_formula50_1

As a result:

MC_formula51

4. Selecting the Sampling Rate for the Digital Regulator

Let’s choose the sampling frequency for our example as well as it was done in the article: “Control System Using the Localization Method from A. S. Vostrikov. C Code and Octave Script.”
Figure 2-1 has two feedback loops. Let’s open the external feedback loop and write down the Laplace transfer function:
MC_formula52
(52) for our example:

MC_formula53

AnalogModalExtOpenLoop

Figure 4-1: Analog Modal Control: Bode Diagram of the External Open Loop

The sampling frequency choice based on 5 degrees = 0.0873 radians of uncertainty caused by sampling, at a cross frequency of 6.28 Rad/s (see the Figure 4-1). In this case, the stability reserves will worsen for the digital control system by about 5 degrees. The uncertainty of the phase is calculated by the formula:

MC_formula54

Then for external loop:

MC_formula55

Now let’s open the internal feedback loop (see the Figure 2-1) and write down the Laplace transfer function:

MC_formula56

AnalogModalIntOpenLoop

Figure 4-2: Analog Modal Control: Bode Diagram of the Internal Open Loop

The cross frequency in this case is 57.5 Rad/s (see the Figure 4-2) then for internal loop:

MC_formula57

Choosing the maximum between (55), (57), we finally choose:
fs = max (36 Hz, 330 Hz) = 330Hz (58)

5. Digital Regulator

The structure of the digital regulator is shown in Figure 5-1

DigitalModalControlWithKalmanBucy

Figure 5-1: Digital Modal Control System with the Kalman-Bucy Filter

The digital regulator (Static Correction, Dynamic Correction, Stable Correction, Object Prediction) is described using z-Transform, and the object is controlled via DAC (Digital to Analog Converter), which is described using ZOH (Zero Order Hold). See a description of the ZOH in [2]. The y(t) output analog signal is read using an ADC (Analog to Digital Converter), which then goes to the digital regulator.
The digital regulator is designed on the basis of the analog one using a bilinear transformation (6).
To analyze and to simulate the control system from our example, the ZOH and Control Object was converted using a bilinear transformation (6) into digital form too.
Static Correction:
MC_formula59
Dynamic Correction:

MC_formula60

Stable Correction:

MC_formula61

Object Prediction:

MC_formula62

Zero Order Hold:

MC_formula63

Object:

MC_formula64

The Step Response of the digital control system is shown in Figure 5-2.

DigitalModalStepResponse

Figure 5-2: Step Response of the Digital Regulator

Thus the control system with a digital regulator meets the specified requirements of the transient process.

6. The Development Steps of the Regulator by the Modal Method

Steps of the design a modal method for object control (8):
  1. Static Correction (7)
  2. Dynamic Correction (10)
  3. Next the characteristic equation for the control system (13) is compiled
  4. Based on the requirements for the transition process, the real roots (15) (to avoid overshooting) of the characteristic equation are selected
  5. The selected roots of the characteristic equation are provided by the choice of parameters (14)
  6. If condition (16) is met then the Kalman-Bucy filter is inserted into the system, the parameters of which are determined from (17)
  7. The sampling frequency for the design of the digital regulator is determined from the cross frequency for the transfer function of the system with open feedback. See the (55), (57)

7. Octave GNU file ModalControl.m

The m script generates magnitude, phase and step responses, test signals and checks the analog/digital modal control systems. To do this, the following functions are defined in this file:

% Plotting the Step Response of the Analog Filter: (…+b1*s^2+b2*s+b3)/(…+a1*s^2+a2*s+a3)
% Input parameters:
% SB — numerator
% SA — denominator
% TimeVector – Time space
function plot_StepResponseAnalogFilter(sys, TimeVector, Text)

% Plotting the Step Response for the Digital Filter: (b1+b2*z^-1+b3*z^-2+…)/(a1+a2*z^-1+a3*z^-2+…)
% Input parameters:
% ZB — numerator
% ZA — denominator
% SampleNumber – Sample number of the step function
function plot_StepResponseDigitalFilter(ZB, ZA, SampleNumber, Text)

% Digital Close Loop: Localization Regulator
% Input parameters:
% ZB_object — numerator
% ZA_object — denominator
% ZB_staticCorrection — nummerator
% ZA_staticCorrection — denominator
% ZD_dynamicCorrection — nummerator
% ZB_dynamicCorrection — denominator
% ZB_stableCorrection — nummerator
% ZA_stableCorrection — denominator
% x_input – input signal
function [y_output] = DigitalModalCloseLoopRegulator(ZB_object, ZA_object, ZB_staticCorrection, ZA_staticCorrection, ZD_dynamicCorrection, ZB_dynamicCorrection, ZB_stableCorrection, ZA_stableCorrection, x_input)

% Float Table to File
% Support C-Code
% Input parameters:
% ParameterVector – data array
% FileNameString – output file name
function FloatParamVector2file(ParameterVector, FileNameString)

8. C Language ModalControl.c/h

The demo SW is realized the digital regulator of the Modal Control System for our example. See the files ModalControl.c/h
Functions:

/*
Control System Initialization
Clear the working arrays
Input: void
Return: void
*/
void ControlSystemInit(void)

/*
IIR Filter with Transposed Form II
Input
float input – filter input
Return
float – filter output
*/
float iir_filter(float input, float const* all_coef_ptr, float* all_history_ptr, uint8 sos_nmb)

/*
Regulator
Input
float require – require value
float object – object value
Return
float – control value
*/
float Regulator(float require, float object)

/*
Object Simulation
Input
float control – control value
Return
float – object output value
*/
float ObjectSimulation(float control)

9. Download the ModalControl.c/h/m

You can download the files:
ModalControl.m
ModalControl.c
ModalControl.h
with the button:

10. Literature / References

[1] A. S. Vostrikov, G. A. Francuzova “Theory of automatic regulation”, Publishing House: Novosibirsk State Technical University, ISBN: 5-7782-0389-6, Novosibirsk, 2003
[2] R. Dorf, R. Bishop “Modern Control System”, Eddison-Wesley, ISBN: 0-201-30864-9, 1998