Identificación no paramétrica

 

⚙️ Non parametric identification

Summary

This section presents a non-parametric identification approach for the dynamic modeling of a DC motor using the reaction curve method. Experimental data were collected from three different tests with distinct input signals to identify the motor’s behavior. First-order with delay (POR) and second-order with delay (SOR) models were developed, simulated, and validated through graphical comparisons with real data from each experiment. Additionally, the MATLAB System Identification tool was employed to derive a model of the motor based on real data. Finally, the most suitable POR and SOR models were selected based on data fitting accuracy and were subsequently discretized.

📌 Introducción


System identification is a crucial tool for analyzing and controlling dynamic systems, as it enables processes to be modeled using experimental data. In digital control, nonparametric identification has the objective of deriving simplified transfer functions that describe first order systems with delay (POR) and second order systems with delay (SOR) by analyzing the system’s response to specific excitation signals.

This practical work focuses on the nonparametric identification of a DC motor to obtain POR and SOR models. To facilitate this, a LabVIEW interface was developed to acquire and store data of the motor's dynamic behavior. This interface allows for the derivation of mathematical models that capture the system's characteristics using a MyRio embedded hardware platform. These models are validated, discretized, and their responses are compared with real data to determine which model best represents the system.


📁  Procedure

An algorithm and a user interface were developed in LabVIEW to acquire and store data on the motor’s dynamic behavior using the reaction curve technique. The interface allowed modification of the percentage of input signal in the system by varying the duty cycle of a PWM signal output of the MyRio platform, which corresponds to the input of the motor driver. Measurements were made using the encoders on the DC motor, which were connected to the Myrio. Then, using a shift register to impose initial condition and a time sample-based calculation the angular speed was calculated. To display the motor speed as percentage of operation, the result was divided by the nominal speed, which was found experimentally and corresponded to 214 RPM. It is important to note that a sampling time of 5 ms was established to ensure accurate data acquisition.


Data collection was performed by applying step-type signals to the motor in an open-loop configuration. Three different step excitations were applied, ensuring that each experiment was completed only after reaching a steady-state value. All steps were applied when the motor had an initial input of 10% of duty cycle, since for lower values, the motor speed dynamic doesn't respond correctly. This value was chosen as well since we plan to operate the DC motor at low speeds to guarantee precision when the SCARA robot has to perform a task. An additional step of ΔU = 20% was applied at this operating point. In the second experiment, a step of ΔU = 40% was applied. A final step of ΔU = 60% was performed for the third experiment.



📌 Código en MATLAB

El siguiente código en MATLAB muestra el proceso de identificación y validación de los modelos:

Contents

    clear all
    close all
    clc
    

    IMPORT DATA FROM CSV

    % Set up the Import Options and import the data
    opts = delimitedTextImportOptions("NumVariables", 3);
    
    % Specify range and delimiter
    opts.DataLines = [1, Inf];
    opts.Delimiter = ",";
    
    % Specify column names and types
    opts.VariableNames = ["Input_1", "Output_1", "Time_1"];
    opts.VariableTypes = ["double", "double", "double"];
    
    % Specify file level properties
    opts.ExtraColumnsRule = "ignore";
    opts.EmptyLineRule = "read";
    
    % Import the data
    tbl = readtable("/MATLAB Drive/CD_motor/Nonparametric_identification/1.csv", opts);
    
    %Convert to output type
    Input_1 = tbl.Input_1;
    Output_1 = tbl.Output_1;
    Time_1 = tbl.Time_1;
    
    % Clear temporary variables
    clear opts tbl
    
    
    % Set up the Import Options and import the data
    opts = delimitedTextImportOptions("NumVariables", 3);
    
    % Specify range and delimiter
    opts.DataLines = [1, Inf];
    opts.Delimiter = ",";
    
    % Specify column names and types
    opts.VariableNames = ["Input_2", "Output_2", "Time_2"];
    opts.VariableTypes = ["double", "double", "double"];
    
    % Specify file level properties
    opts.ExtraColumnsRule = "ignore";
    opts.EmptyLineRule = "read";
    
    % Import the data
    tbl = readtable("C:\Users\juanj\MATLAB Drive\CD\Nonparametric_identification\2.csv", opts);
    
    % Convert to output type
    Input_2 = tbl.Input_2;
    Output_2 = tbl.Output_2;
    Time_2 = tbl.Time_2;
    
    % Clear temporary variables
    clear opts tbl
    
    % Set up the Import Options and import the data
    opts = delimitedTextImportOptions("NumVariables", 3);
    
    % Specify range and delimiter
    opts.DataLines = [1, Inf];
    opts.Delimiter = ",";
    
    % Specify column names and types
    opts.VariableNames = ["Input_3", "Output_3", "Time_3"];
    opts.VariableTypes = ["double", "double", "double"];
    
    % Specify file level properties
    opts.ExtraColumnsRule = "ignore";
    opts.EmptyLineRule = "read";
    
    % Import the data
    tbl = readtable("C:\Users\juanj\MATLAB Drive\CD\Nonparametric_identification\3.csv", opts);
    
    % Convert to output type
    Input_3 = tbl.Input_3;
    Output_3 = tbl.Output_3;
    Time_3 = tbl.Time_3;
    
    % Clear temporary variables
    clear opts tbl

    POR 

    theta_por = (0.0025 + 0.005 + 0)/3;
    tau_por = (0.0525 + 0.075 + 0.045)/3;
    K_por = (1.037 + 1.0425 + 1.0475)/3;
    POR = tf(K_por,[tau_por 1],'InputDelay',theta_por)
    step(POR)

    SOR 

    theta_sor = (0.02853 + 0.0309 + 0.0212)/3;
    tau_sor = (0.0525 + 0.075 + 0.045)/3;
    Tau1 = (0.02331+0.01608+0.0231)/3;
    Tau2 = (0.004479+0.001746+0.00488)/3;
    K_sor = (1.037 + 1.0425 + 1.0475)/3;
    SOR = tf([K_sor],[Tau1*Tau2 Tau1+Tau2 1],'InputDelay',theta_sor)
    step(SOR)

    Data adjustment

    Ts = 0.005;
    initial_value = 10;
    time_in1 = 1.845;
    time_in2 = 1.975;
    time_in3 = 1.375;
    index1 = time_in1/Ts+1;
    index2 = time_in2/Ts+1;
    index3 = time_in3/Ts+1;
    offset1 = mean(Output_1(1:index1-1,1));
    offset2 = mean(Output_2(1:index2-1,1));
    offset3 = mean(Output_3(1:index3-1,1));
    time_1a = Time_1(index1:end,1)-time_in1;
    input_1a = Input_1(index1:end,1)-initial_value;
    output_1a = Output_1(index1:end,1)-offset1;
    time_2a = Time_2(index2:end,1)-time_in2;
    input_2a = Input_2(index2:end,1)-initial_value;
    output_2a = Output_2(index2:end,1)-offset2;
    time_3a = Time_3(index3:end,1)-time_in3;
    input_3a = Input_3(index3:end,1)-initial_value;
    output_3a = Output_3(index3:end,1)-offset3;

    COMPARISSON POR AND SOR 

    close all
    %modelo identificación parametrica
    %parametric=tf([1.85],[0.15 1],"InputDelay",0.13);
    para=tf([2436],[1 45.83 136.1])*0.05607
    figure(1)
    hold on
    %plot(time_1a,output_1a,'Color','r')
    %plot(time_1a,input_1a, 'Color','b')
    step(POR,'k')
    step(SOR,'g')
    %step(20*para,"y")
    legend('POR', 'SOR')
    title('Model comparisson')
    %
    
    close all
    %From system identification tool it was obtained POR and SOR models
    POR_tf1=tf([17.79],[1 17.19], "InputDelay", 0.0025)
    SOR_tf1=tf([131.4],[1 22.23 127],"InputDelay", 0.0285)
    figure(4)
    hold on
    step(POR_tf1)
    step(SOR_tf1)
    legend('POR', 'SOR')
    title('System identification')

    COMPARISSON SI AND POR

    %The selected model was POR model
    
    
    close all
    %The selected model on point 2 was POR model of experiment 1
    figure(5)
    hold on
    step(POR_tf1)
    step(POR)
    legend('System Identificator', 'POR')
    title('System identification vs POR')

    DISCRETIZATION

    %Ts was obtained from the closed loop tf of the system without delay with
    %the settling time criteria and the discretization method used was Tustin's
    %method
    close all
    PORd = c2d(POR, 0.005, 'tustin')
    figure(8)
    hold on
    step(POR)
    step(PORd)
    legend('Continuous', 'Discrete')
    title('Continuous vs Discrete')

    📊 Resultados y Comparaciones

    Graphical comparisons were made between the obtained models and the experimental data.

    🔹  POR vs. SOR 
    📊                                                     






    🔹 POR model vs. SOR model vs Parametric model - Average experiments
    📊 

                                            




    🔹 POR model vs. SOR model  - System identification
    📊 

     


    🔹  System identification model vs. POR  model
    📊 

    El modelo seleccionado fue el POR.






    🔹 Comparison between continuous and discrete time:   
    📊 


    Sample time: 0.005
    Discretization method : "Tustin"
     











    📌 Conclusiones

    ✔️ POR and SOR models were successfully adjusted to accurately represent the behavior of the DC motor.
    ✔️ According to the nonparametric identification process, the models that best represent the speed dynamics of the DC motor in this case are the POR models, based on the graphical validations performed, which allowed for comparisons between the obtained POR and SOR models against the real data.
    ✔️ The model was discretized using the Tustin method for its implementation in digital control systems.
    ✔️ The main difference between the behavior of parametric and nonparametric identification models is attributed to the use of different drivers for motor control.




    Comentarios

    Entradas populares de este blog

    INFORMACIÓN PROYECTO