当前位置:网站首页>[classical control theory] summary of automatic control experiment

[classical control theory] summary of automatic control experiment

2022-07-05 23:21:00 robinbird_

※ Automatic control system script writing

1、 Variable

sym, syms Symbolic variables

sym a;
syms a b;
f = str2sym('a+ b^2');

2、 Basic operation

  1. Derivation

    dfa = diff(f function ,a For which variable ( partial ) guide );
    
  2. Accumulated faintness

    intb = int(f function ,b Which variable to integrate ,b1,b2 Section );
    
  3. Laplace transform

    %t You still have to define it in advance ,s Finding Laplace transform will bring 
    ft = exp(2*t);
    L1 = laplace(ft);
    
  4. Inverse Laplace transform

    ftt = ilaplace(L1);
    

3、 Control system model

  1. Polynomial form ( Transfer function model )

    [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-doVagqrR-1657012369280)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220420210012659.png)]

    The coefficients are stored continuously in an array , An array of numerators and denominators , Pass from high to low

    num = [1 2 3];  % The coefficient corresponding to the molecule 
    den  = [4 5 6 7]; % The coefficient corresponding to the denominator 
    gs = tf(num,den);
    

    [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-KrNrLKHm-1657012369284)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220420210717309.png)]

  1. Zero pole model

    Two arrays are required , ditto , Add one more k gain

    z = [1 2 3]';  % zero , Pay attention to add transpose 
    p = [4 5 6 7]; % pole 
    k = 9;
    gs2 = zpk(z,p,k);
    

    [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-joecKule-1657012369287)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220420211133977.png)]

  2. Interconversion

    [num,den] = zp2tf(z,p,k);
    % Zero pole transfer function 
    
  3. Other expressions

    molecular / The denominator expression has zpk type , But need tf When the format , Use conv( It's polynomial multiplication ) Unified conversion to polynomial type , for example

    num = [1 2.9 2];
    den = conv([1 0],[1 10 25]);
    gs = tf(num,den);    % The root locus diagram should be drawn later 
    

     Insert picture description here

4、 Connection of models

  1. Series connection — series

    [num3,den3] = series(num,den,num2,den2);
    
  2. parallel connection — parallel

    [num3,den3] = parallel(num,den,num2,den2);
    
  3. feedback — feedback

    [num3,den3] = feedback(numg,deng,numh,denh,sign);
    % First give G(s) Transmission characteristics of , Give again H(s) Transmission characteristics of , Last sign Is the default -1( Negative feedback ), It can be changed +1( The positive feedback )
    
  4. Unit feedback — cloop

    [num3,den3] = cloop(numg,deng,sign);
    % Less than above H(s)
    

5、 Typical input function

  1. Unit step function — step

    t = [0:0.1:100];
    num = 1;
    den = [1 0.4 1];
    step(num, den, t);
    %t The main thing is to explain how long to draw t Of ct Images ,num,den Directly transfer the characteristic array of the closed-loop transfer function 
    
  2. Unit pulse function — impulse

    t = [0:0.1:100];
    num = 1;
    den = [1 0.4 1];
    impulse(num, den, t);
    %t The main thing is to explain how long to draw t Of ct Images ,num,den Directly transfer the characteristic array of the closed-loop transfer function 
    
  3. Custom input — lsim

    t = 0:0.1:10;
    
    %u Contain with t The expression of , such as 
    u = t;
    % perhaps 
    
    lsim(num,den,u,t);
    lsim(z,p,k,u,t);
    % It is still the beginning to give the characteristics of the closed-loop transfer function of the system , The above two forms are acceptable ,u It's input r(t), Contain with t Expression of integer ,t Is time 
    
    % for example , This is used for frequency characteristic test , Input a sine function to the system 
    t = [0:0.001:10];
    rt = 1* sin(15 * t);
    lsim(nums,dens,rt,t);
    
    
    
  4. Be careful : After using all the above functions , If you use its return value , It defaults to direct single window drawing ; If you use a variable to store the return value ( It is the result of the system output , It's a one-dimensional array ), Then it can be used to draw multiple graphs

6、3 A system characteristic image

  1. Root locus drawing

    gs = tf(num,den);
    rlocus(gs);  % What is given is the complete function expression , And here the first expression of the open-loop transmittal ( Without root track gain K*)
    
  2. Nyquist

    matlab The painting contains w from 0 To -∞ Track of , Completely symmetrical with the positive part , Never mind

    nyquist(gs);   % Pass reference pass   Open loop transmittal expression 
    
  3. bode chart

    bode(gs);    % Same as before , Generally, it draws an open-loop logarithmic amplitude frequency diagram , Then give the expression of open loop 
    

    for example , Left root locus , Right bode chart

     Insert picture description here

7、matlab Drawing method

  1. Basic drawing settings

    grid;  % Adding grid 
    xlabel(" Title name ");  % Set the name of the abscissa 
    ylabel(" ditto ");  % Vertical axis name 
    title("abb");   % The name of the drawn image 
    
  2. Multigraph drawing

    (1) Draw a picture in one window , Be careful ,grid and legend Such special requirements do not apply to all windows , Every figure Add it separately if necessary

    figure;
    %code, Draw a picture 
    
    figure;
    %code, Draw another picture , And so on 
    
    % give an example , First draw a bode chart , Draw another Nyquist diagram 
    figure;
    z = [-0.2];
    p = [0 -0.1 -4];
    k = 16;
    [num,den] = zp2tf([],[0 -4*sqrt(2)],k);
    tf_gs = tf(num,den);
    bode(tf_gs);
    
    figure;
    nyquist(tf_gs);
    grid; %attention
    

     Insert picture description here

    (2) Multiple graphs are drawn in one window

    ​ First of all, we need not let matlab Draw the response directly , Just use variables to receive the return value

    t = 0:0.1:10;
    y_step = step(numfi,denfi,t);  % Receive return value 
    
    u = t;
    y_ramp = lsim(numfi,denfi,u,t);   % Receive return value 
    

    ​ Then use a format similar to the previous one ,subplot Refer to this article for the parameters of :http://t.csdn.cn/pXIZ5

    subplot(x1,y1,z1);
    plot(t1,c1);
    axis normal;
    
    subplot(x2,y2,z2);
    plot(t2,c2);
    axis normal;
    
    % give an example , Continue with the previous content 
    subplot(2,1,1);
    plot(t,y_step);
    xlabel(" Time /s");
    ylabel("c(t)");
    grid;
    axis normal
    
    subplot(2,1,2);
    plot(t,y_ramp);
    xlabel(" Time /s");
    ylabel("c(t)");
    axis normal
    grid;
    

 Insert picture description here

※simulink Plug in emulation

[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-WYEGSDxt-1657012369295)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220421104137653.png)]

Name of common component library

And here is , Directly check the corresponding... In the component library name Search and you'll get

  • gain K gain

  • Transfer function

    • Polynomial type transfer fcn

      [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-22Wx11XX-1657012369297)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220705111245340.png)]

    [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-juj7D7RC-1657012369299)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220421100000555.png)]

    • Zero pole model Zero-Pole

      [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-ZF0zAQEi-1657012369301)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220705115014808.png)]

  • Oscilloscope scope

  • Ramp signal ramp

  • Step signal step

  • Sine signal sine wave

  • Sum up sum

  • Dead zone module dead zone

  • Limiting module saturation

  • Analysis of system characteristic diagram of transfer function

    First use of in and out modular , Build the following model

     Insert picture description here

    For a transmittal module , Right click , find Linearize block

     Insert picture description here

    Select the source of input and output as shown in the following figure , Then click the system characteristic curve you want to obtain , You can draw directly

     Insert picture description here

    If you want to draw multiple curves on the same graph ( It is mostly used for system calibration ), Just after the first drawing ,( I'm right simulink After simply modifying the parameter value of the model ), Then click the current plot The button , There are two pictures , Stack in this way

     Insert picture description here

     Insert picture description here

  • PID modular PID controller

    Corresponding modification PID Three parameters are sufficient

    You can also use PID tunner Instantly adjust rapidity and volatility , See the picture below

     Insert picture description here

     Insert picture description here

※ Scripts and simulink Dream linkage

  1. take simulink Simulation data is used .m Script processing

    Directly use the transfer function model , Through one more simout To transmit the data is

    [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-N2SWPYb2-1657012369310)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220508110156814.png)]

    [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-ySVKe33P-1657012369310)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220508110214336.png)]

    Several setting modes

    1. structure with time

      This is Time And corresponding Output

      plot(out.so.time, out.so.signals.values);
      %out It should be added so to simout The name of life , This can be customized , Because a .slx There can be many songs simout modular 
      

      [ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-WLfDF5oo-1657012369312)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220508110510079.png)]

    2. structure

      Only Output

      yt = out.so.signals.values;
      
    3. array

      Only Output , Return... As an array

      plot(out.so);
      
    4. timeseries

      plot(out.so.Time,out.so.Data);
      
  2. use .m Draw Lissajou figure / Time domain response curve

    Here we directly use the code of the eighth experiment of automatic control

     Insert picture description here

    figure;
    plot(x.signals.values,y.signals.values);
    title(" Lissajous figure ");
    grid;
    
    figure;
    plot(x.time,x.signals.values);
    hold on;
    plot(y.time,y.signals.values);
    legend(" Input "," Output ");
    title(" Time domain curve ");
    grid;
    
  3. It can be used x( Corresponding to the input of the system ), and y( Corresponding to the output of the system ) Direct use matlab fitting

    Be careful : First the x,y The data type of is set to 2-D array, It's a two-dimensional array , Then follow the steps in the following article Data import

    http://t.csdn.cn/NrfDU

    Next, analyze the link :operations Personally, I don't think it's necessary , The analysis method is the transmittal mode , You need to give the number of zeros and poles ,matlab Direct fitting according to the number of zeros and poles

     Insert picture description here

    Take the screenshot of your eighth experiment as an example , No zero point was selected at that time ,3 A pole

     Insert picture description here

※ The principle of automatic control makes up the leak ~~( A vegetable dog didn't understand until he finished the exam )~~

Mainly with The higher-order system uses the dominant pole reduction method and Frequency test of , Combined with the specific experimental content of automatic control, briefly explain

1、 Order reduction of dominant poles of higher-order systems

  1. subject ( The first question is ignore ): Insert picture description here

  2. Personal understanding : The given transfer function is the open-loop transfer function of this system , And the corresponding root locus gain is 160, If you want to draw, you will get no 160 The transmittal of is passed as a parameter to rlocus Just draw ;

    And for order reduction , You need to get in K*=160 All the roots of , Actually use matlab Find the root locus diagram drawn in the diagram 4 It's better to go directly to Casio 991 Solve the equation fragrant , Get more accurate results directly , See tutorial

    fx-991CN X equation ( Group ) Use of solving function - Dianzhuo Yuanya Jiliang's article - You know https://zhuanlan.zhihu.com/p/28795401

  3. Theoretical knowledge supplement : First film a wave of explanation from the giant of Harbin Industry :https://www.bilibili.com/video/BV1cK4y1U7jR?share_source=copy_web

    For the reduction of higher-order systems , It is necessary to ensure the stability of the system before and after order reduction Closed loop gain unchanged , So the best way is to get the closed-loop transmittal of the system , Written as closed-loop zero pole form , Then analyze the position of closed-loop zero pole , There are a pair of very close zeros and poles ( Dipole , In the blue box ), Can be removed , remainder The real part of the pole does not 2-3 Times more , Therefore, none of them can be omitted

     Insert picture description here

     Insert picture description here

  4. result : according to K The unchanging principle , Whoever gets rid of it will leave the corresponding constant term , Finally, the step response curve is obtained

     Insert picture description here

     Insert picture description here

2、 Frequency characteristic test

  1. subject :[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-f2A0Bgbr-1657012369319)(C:\Users\robinbird\AppData\Roaming\Typora\typora-user-images\image-20220705161314080.png)]

  2. Add :

    (1) The solution of phase and amplitude is as follows , So just need to be in Lissajou image (x For input ,y For export ) Found in Image and x=0 The intersection of the axes , Find in the step response curve Peak value of input / output image Put it in a table , Just draw a picture
    R ( t ) = A 0 ∗ s i n ( w t ) C ( t ) = A 1 ∗ s i n ( w t + φ ) A ( w ) = A 1 / A 0 φ ( w ) = a c r s i n ( C ( 0 ) / A 1 ) R(t) = A_{0}*sin(wt)\\ C(t) = A_{1}*sin(wt+φ)\\ A(w) = A1/A0\\ φ(w) = acrsin(C(0)/A1) R(t)=A0sin(wt)C(t)=A1sin(wt+φ)A(w)=A1/A0φ(w)=acrsin(C(0)/A1)
    (2) There are also aspects , Lissajou's image is elliptical , The inclination angle of its long axis ( And right x Included angle of shaft ) It's probably the phase difference , So we need to Pay attention to phase override 90°/180°/270° etc. , Modify the corresponding phase solution formula in time

    Like this picture , It's a positive ellipse , The phase is close 90°

     Insert picture description here

    This is more than 90° 了

     Insert picture description here

    (3) But you can find that the curve above is not smooth enough , So I copied the similar model settings sent by the teacher before , The curve is instantly beautiful : stay simulink Look for this setting in the interface

     Insert picture description here

    (4) Next is excel processing section , Get organized w/A1/A0/C0 And use excel Function of , Using the type of scatter plot with asymptote , You can get the image of frequency characteristic test , And according to the maximum phase 、 The turning point 、 Initial phase 、 Initial amplitude, etc

     Insert picture description here

    (5) Although obviously 3 Order system , But the analysis method of second-order system is also ok 、、、 But this is not recommended ,system identification Doesn't it smell good ; Other ways , For example, some information can be obtained from the curve of step response to fit the function

  3. It's also a doubt that will be solved after the exam ( Pure is because he sprinkled money ):bode The picture is only for Transfer function The expression of , It has nothing to do with open-loop and closed-loop , It only uses this function The sinusoidal response result of A、φ, So all kinds of typical transmittal links in the book ( inertia 、 Oscillate 、 First and second order differential 、 Integral, etc. ) These results are applicable to the observation of frequency characteristics

automatic control 1 End of the flower **ヽ(°▽°)ノ*, Already a self-control person

原网站

版权声明
本文为[robinbird_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207052302410855.html