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

### 2. Introduction

##### Figure 2-1 shows an Analog Modal Control System:

Figure 2-1: Analog Modal Control System

##### 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:

Figure 2-2: Analog Kalman-Bucy Filter

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

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

### 3. Analog Example

##### The step response of the object is shown in Figure 3-1:

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

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

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

### 4. Selecting the Sampling Rate for the Digital Regulator

##### (52) for our example:

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

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

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

### 5. Digital Regulator

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

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

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

Figure 5-2: Step Response of the Digital Regulator

### 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

##### 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)