 ## Control System Using the Localization Method from A. S. Vostrikov. C Code and Octave Script.

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

##### Figure 2-1: Analog Localization Control System   ##### If K is a large quantity (or K => +∞) then:  ##### Thus we obtain the desired characteristic of the transient process at large values of K, while the external disturbance m(t) is completely suppressed. It is recommended to choose a loop gain: ##### In this case the adjustment error of (20) for a static signal without disturbances m(t)=0 in steady-state mode s=0: ### 3. Analog Example

##### Let there be a second-order control object described by a transfer function: ##### Figure 3-1: Step Response on the Control Object without Regulator

##### Figure 3-2: Required Step Response

##### Now let’s choose a filter that suppresses high-frequency interference in the feedback, using (15), (16): ##### Then: ##### Using (23) we select the loop gain: ##### Then from (26): ##### To estimate the stability reserves, we calculate the transfer characteristic of the system with open feedback: ##### Then magnitude and phase response of the open loop is showed on the Figure 3-3: Figure 3-3: Open Loop Magnitude and Phase Response ##### Close Loop Step Response is showed on the Figure 3-4. The system has the desired transient response: Figure 3-4: Close Loop Step Response

### 4. Digital Regulator

##### Now we implement the regulator from our example in digital form. Let’s choose the sampling frequency based on 5˚ degrees = 0.0873 radians of uncertainty caused by sampling, at a cross frequency of 125 Rad/s (see (37)). In this case the stability reserves (38) will worsen for the digital control system by 5 degrees and will amount to 50˚ – 5˚ = 45˚ degrees, which is also sufficient for stable operation. The uncertainty of the phase is calculated by the formula: ##### Then: ##### The structure of the digital regulator is shown in Figure 4-1 Figure 4-1: Localization Control System with Digital Regulator

##### To analyze and simulate the control system from our example, the whole control system was converted using a bilinear transformation (6) into digital form, including ZOH and Object.  ##### The step response of the digital control system is shown in Figure 4-2. Figure 4-2: Step Response of the Localization Control System with Digital Regulator

### 6. Octave GNU file LocalizationControlSystem.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:
% 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:
% K — gain
% ZB_object — numerator
% ZA_object — denominator
% ZB_feedback — numerator
% ZA_feedback — denominator
% x_input – input signal
function [y_output] = DigitalCloseLoopLocalizationRegulator(K, ZB_object, ZA_object, ZB_feedback, ZA_feedback, x_input)

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

### 7. C Language LocalizationControlSystem.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)