BodeDiagramType2Modification

Typical Open Loop Bode Diagram for Control Systems. C Code and Octave Script

 

1. Abbreviation

OL_formula1_6

 

2. Introduction

Most linear control systems can be represented in the following form:

AnalogControlSystem

Figure 2-1: Analog Control System

OL_formula7_11

Then the open-loop transfer function of the control system:

OL_formula12

Transfer function for closed-loop control system:

OL_formula13

Obviously the control error is for a closed control system:

OL_formula14

OL_formula14_1

A few important notes and formulas:
  1. It is convenient to evaluate the quality of the linear system by applying the following test signals to the input:
    OL_formula15
    OL_formula16
    OL_formula17
  2. To calculate the steady state values of the transient process, we will use the well-known formula:

    OL_formula18
  3. The stability reserves will be estimated by the phase at the cross frequency:

    OL_formula19

    or logarithmic scale (in dB):

    OL_formula19a

    Phase shift:
    OL_formula20
    At this frequency there is a ballance of amplitudes in the feedback and if the phase reaches φ = -180 ° degrees, then this will lead to undamped oscillations in the control system with a frequency of ω_crosss.
    To ensure an acceptable transition process, it is necessary to have a phase margin at least 58 ° degrees at the cross frequency. See the table:

    OL_table2_1
    Table 2-1: Step Response Overshoot for the Difference Phase Margin (from the [1])

  4. Integrator:
    OL_formula21

    OL_formula22_23

    Then from (18) get the adjustment error:

    OL_formula24

    Now we will send a linear signal (16) to the input of the control system with an integrator

    OL_formula25

    In this case there is a control error and it decreases if the Kv is increased.
    Conclusion:
    Thus the control error for the static signal (step response) is zero if there is an integrator. Similarly it can be proved that if two integrators 1/s^2 are used, then the static (step response) and speed (linear response) control error is zero. And if there are three integrators 1/s^3, then the static (step response), speed (linear response) and acceleration (parabola response) control error is zero. In the last two cases (using two or three integrators) it is difficult to design a stable control system.
  5. Then I will use the magnitude and phase on the Bode graph. These graphs are plotted on a logarithmic scale. For example, let’s take a transfer function with one pole:
    OL_formula26_27
    Substituting s=jω in (26):

    OL_formula28

    Turning to the logarithmic scale:

    OL_formula29_30

    OL_formula31_33

     

    OL_formula34_36

    OL_formula37_39
    Figure 2-2 shows an example of a Bode Diagram:

    OL_formula40

    SimpleBodeDiagramModification

    Figure 2-2: Bode Diagram for One Pole Transform Function (40)

 
Conclusions:
  • Pole: Magnitude Response has the -20 dB/decade (or -6dB/octave) and -3dB in pole frequency.
    Phase Response has the -45° for ω = ω_pole and -90° for ω >> ω_pole
  • Zero: Magnitude Response has the +20 dB/decade (or +6dB/octave) and +3dB in pole frequency.
    Phase Response has the +45° for ω = ω_zero and +90° for ω >> ω_zero

     

    Transform function example with zero:
    OL_formula41

 

3. The First Type of the Bode Diagram for Control System

The first type of characteristic is used most often and has the form:

OL_formula42_43

This transfer function has an integrator and a pole that is selected near the cross frequency:

OL_formula44_45

The phase at the cross frequency (≈ pole) will be:

OL_formula46

Phase Margin:

OL_formula46a

This leads to an outlier (overshoot), see the Table 2-1:

OL_formula47

Take as an example:

OL_formula48

BodeDiagramType1Modification

Figure 3-1: Bode Diagram for the (48)

StepResponse1_2Type1Modification

Figure 3-2: Step Response for the (48)

The speed error (linear response) is calculated by the formula (25) at v=10:

OL_formula49

LinearResponse1_2Type1

Figure 3-3: Linear (Speed) Response for the (48)

ParabolaResponse1_2Type1

Figure 3-4: Parabola (Acceleration) Response for the (48)

To reduce overshoot: 1.23, it is necessary to increase the phase margin at the cross frequency => to decrease Kv. For example adjust the transfer function:

OL_formula50

The cross frequency is 60Rad/s and the phase margin in this case is 58°(see Table 2-1), which corresponds to overshoot:

OL_formula51

On the Figure 3-5 Step Response for (50):

StepResponse1_1Type1Modification

Figure 3-5: StepResponse for the (50)

With a decrease in Kv, the error in speed (linear response) and acceleration (parabola response) increases. Speed error for (50) and for v=10:

OL_formula52

 

4. The Second Type of the Bode Diagram for Control System

The second type of characteristic has the form:

OL_formula53_57

The cross frequency is selected so that:

OL_formula58

in this case the maximum phase correction from zero at the cross frequency is obtained.
[1] recommends choosing:

OL_formula59

Substitute (58) in (59):

OL_formula59a

You need to choose Kv using the formula (60) varying ω1:

OL_formula60

The phase at the cross frequency is calculated by the formula:

OL_formula61

Then the margin by phase:

OL_formula61a

Note:

OL_formula61_1

Thus we obtain a phase margin ≥ 53 °.
 
Consider an example:
To design a control system with a characteristic of the second type with the following parameters:
System Requirement
Gain:
OL_formula61_2
Frequency band of the control system:
OL_formula61_3
Design
Then from (59):
OL_formula61_4
From (60):
OL_formula61_5
Finally:
OL_formula62
Phase margin:

OL_formula62_1

BodeDiagramType2Modification

Figure 4-1: Bode Diagram for the (62)

The phase margin is 59°, and the overshoot is 1.16 (see the Figure 4-2), which exceeds the data of Table 2-1. This is due to the fact that (62) has zero, and in this case large phase reserves are required at the cross frequency. To reduce the overshoot we need to increase ω1 and thereby to decrease the Kv.

StepResponse_Type2Modification

Figure 4-2: Step Response for the (62)

The speed error (linear response) is calculated by the formula (25) at v=10:

OL_formula63

The error is much smaller than for the Type 1 characteristic. Compare Figure 4-3, Figure 3-3, as well as Figure 4-4, Figure 3-4.

LinearResponse_Type2

Figure 4-3: Linear (Speed) Response for the (62)

ParabolaResponse_Type2

Figure 4-4: Parabola (Acceleration) Response for the (62)

 

5. Digital Realization of the Regulator

Let there be a control object (plant) described by a transfer function:

OL_formula64_65

The task is to implement a control system that provides a characteristic (62) for controlling the object (64). To do this we need to implement a controller of the form:

OL_formula66

An additional zero
OL_formula66_1
is added to the regulator to compensate for the pole of the object.
Now let’s choose the sampling frequency based on the allowable uncertainty of the phase at the cross frequency.
OL_formula67
Let’s choose the uncertainty in phase 2° at the cross frequency. Then:

OL_formula68

The digital regulator is shown in Figure 5-1:

DigitalControlSystem

Figure 5-1: Digital Control System

The object (plant) is controlled by the signal of the controller u(nTs), which is fed to the Digital to Analog Converter (DAC). The DAC transfer function is approximated as Zero Order Hold. See the [2]. The signal y(t) – the measured value from the output of the object, passing through the Analog to Digital Converter (DAC) is converted back to digital form. The measured value of y(nTs) is compared with the required value of x(nTs) and then fed to the input of the digital controller.
Convert the regulator (66) to digital form using a bilinear transformation (6):
OL_formula69
To simulate the operation of a digital controller, we will also convert the analog part of the control system into digital form:

OL_formula70_71

The system’s response to the step signal is shown in Figure 5-2. The overshoot is 4% worse than that of the analog prototype (compare with the Figure 4-2). This is caused by the sampling of the signal, which in our case leads to 2° uncertainty in phase at the cross frequency.

 

StepResponse_Digital_Type2Modification

Figure 5-2: Step Response for the (69), (70), (71)

 

6. Conclusions

  1. The Type 1 of the characteristic is simple and is most often used in applications. There is no static error, but there is a speed and acceleration error. In such systems it is difficult to obtain large Kv values and therefore reduce the speed and acceleration control error.

     

  2. The Type 2 of the characteristic is more difficult to ensure the stability of the system, but at the same time it is possible to obtain large Kv values, which reduces speed and acceleration control errors. Here it is possible to reduce the speed error to zero.

     

  3. Both characteristics use an integrator, which means that it is necessary to use Antiwindup methods. In the examples this implementation is not given, but it should be implemented in real control systems.

 

7. Octave GNU file OpenLoopMagnitudePhaseRespTypes.m

The m script generates magnitude, phase and step responses of the Bode Diagrams for types 1 and 2, test signals and checks the analog/digital 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: Regulator and Object
% Input parameters:
% ZB_Regulator — numerator
% ZA_Regulator — denominator
% ZB_Object — numerator
% ZA_Object — denominator
% x_input – input signal
function [y_output] = DigitalCloseLoopRegulatorObject(ZB_Regulator, ZA_Regulator, ZB_Object, ZA_Object, 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 BodeDiagramType2.c/h

The demo SW is realized the digital regulator of the Bode Diagram Type2. See the files BodeDiagramType2.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
float const* all_coef_ptr – filter coefficients
float* all_history_ptr – filter history
uint8 sos_nmb – second order section number
Return
float – filter output
*/
float iir_filter(float input, float const* all_coef_ptr, float* all_history_ptr, uint8 sos_nmb)

 

/*
Regulator
Input
float delta – (require – measurement) value
Return
float – control value
*/
float Regulator(float delta)

 

9. Download the OpenLoopMagnitudePhaseRespTypes.m and BodeDiagramType2.c/h

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

 

10. Literature / References

[1] E. Krogius “Radio Automation Course of Lectures“, LEIC, 1981
[2] R. Dorf, R. Bishop “Modern Control System”, Eddison-Wesley, ISBN: 0-201-30864-9, 1998