 ## Control of Non Linear Object Using the Vostrikov’s Localization Method. C Code and Octave Script

### 1. Abbreviation ### 2. Introduction

##### Let there be a control object which is described by the differential equation: ##### Let there be a desired linear differential equation for a closed system that provides the required transients and is described by the equation: ##### The control signal as mentioned above is formed by the highest derivative: ##### Substitute (9) into (7) and solve the equation with respect to the highest derivative: ##### Formula (10) for large K (K = > +∞) will take the form: ##### It is recommended in ,  to choose K: ##### From what has been said the control system will take the form shown in the Figure 2-1 Figure 2-1: Localization Control System  ##### We introduce a notation for the filter polynomial DF (15): ##### The DF filter suppresses high-frequency interference in the feedback while in ,  it is recommended to choose: ##### In ,  it is proved that the choice of parameters according to formula (18) makes it possible to divide the system into two subsystems of fast and slow processes / motions, while fast motions are described by linear differential equations, which simplifies the assessment of the stability of the control system. Figure 2-2 shows the subsystem of fast motions. Figure 2-2: Subsystem of Fast Motions

##### The characteristic equation of the differential equation for the subsystem of fast motions has the form: ##### The subsystem is stable if the solutions (20) lie in the left ‘s’ half-plane: ### 3. Example of an Analog Regulator

##### Let there be a nonlinear control object described by the differential equation: ##### Figure 3-1: Non Linear Object

##### Now let’s choose the transfer function of the desired transition process: ##### Figure 3-2: Required Step Response

##### Now let’s choose a Derivative Filter that suppresses high-frequency interference, using (18) and (19): ##### Then: ##### From (16) and (26): ##### To calculate the remaining coefficients, three poles of the DF are selected using the formula: ##### Let ‘s choose for example: ##### Then: ##### Using (12) and (22) we choose the loop gain: ##### Let’s evaluate the stability of the subsystem of fast motions using (20): ##### Figure 3-3: Example of the Localization Control System with analog Regulator

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

##### In a static working point, all derivatives are zero and (34) will be rewritten as: ##### Obviously we have a static working point at zero values: ##### Now we linearize (34) at working point zero: ##### Returning in (35) to the single-channel representation for the linearized control object at the zero operating point: ##### In Laplace Form: ##### Now let’s make a transfer function for the open control system shown in Figure 4-1 using the linearized control object (37):  Figure 4-1: Analog Open Loop Magnitude and Phase Response of Linearization Control System

##### From the graphs in the Figure 4-1 it can be seen that at ##### To implement the digital regulator, we will select the sampling frequency based on 5 degrees = 0.0873 radians at a cross frequency: 230 Rad/s (see (39)). The uncertainty of the phase is calculated by the formula: ##### Then: ### 5. Example of a Digital Regulator

##### The structure of the digital controller is shown in Figure 5-1 Figure 5-1: Localization Control System with Digital Regulator

##### The digital regulator is calculated on the basis of the analog one using a bilinear transformation (6), where: ##### Then: ##### A nonlinear control object in digital form is shown in Figure 5-2: Figure 5-2: Digital Non Linear Object

##### The step response of the digital control system is shown in Figure 5-3: Figure 5-3: Step Response of the Digital Regulator

### 7. Octave GNU file LocalizationForNonLinearObject.m

##### The m script generates magnitude, phase and step responses, test signals and checks the analog/digital localization 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:
% sys – object of the analog filter
% TimeVector – Time space
% Text – plot titel
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
% Text – plot titel
function plot_StepResponseDigitalFilter(ZB, ZA, SampleNumber, Text)

% Digital Close Loop with 3d order derivative filter (DF3): Localization for Non Linear Object
% Input parameters:
% x_input – input signal
% K — gain
% w_required – required transient process parameter
% Q_required – required transient process parameter
% SA_derivative3 – derivative polynomial
% a_obj_1 – object parameter
% a_obj_0 – object parameter
% b_obj – object parameter
% Ts – sample time
% Output parameter:
% y_output — output
function [y_output] = DigitalCloseLoopLocalizationNonLinearDF3(x_input, K_gain, w_required, Q_required, SA_derivative3, a_obj_1, a_obj_0, b_obj, Ts)

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

### 8. C Language LocalizationForNonLinearObject.c/h

##### Functions:

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

/*
Bilinear Integrator
y(n)=y(n-1)+(Ts/2)(x(n)+x(n-1))
Input
float input – input
integrator_data_s* history_ptr – integrator history
Return
float – output
*/
float bilinear_integrator(float input, integrator_data_s* history_ptr)

/*
Zero Order Hold
y(n)=(1/2)(x(n)+x(n-1))
Input
float input – input
float* previous_ptr – previous input
Return
float – output
*/
float zero_order_hold(float input, float* previous_ptr)

/*
Regulator
Input
float x_require – require value
float y_object – object/measurement value
Return
float – u_control value
*/
float Regulator(float x_require, float y_object)