PID to 1Hz Sine wave

Discussion in 'General Electronics Chat' started by rbpassos, Mar 22, 2015.

  1. rbpassos

    Thread Starter New Member

    Mar 22, 2015
    8
    0
    I am building an aplication to track a sinusoidal wave, frequencies can vary from 1 to 3 Hz.

    I only know PID as the control solution and tried to implement it in Labview.

    The video bellow shows the plant i am tring to control.


    Is the PID a possible solution? I have been experince wave forms very diferente than sine.

    Thanks a lot for your attention!!
     
  2. crutschow

    Expert

    Mar 14, 2008
    12,991
    3,226
    What do you mean "track a sinusoidal wave"?
    Are you trying to have that actuator follow the sine-wave?
    At what point does this fail?
     
  3. rbpassos

    Thread Starter New Member

    Mar 22, 2015
    8
    0
    Hello Mr. crutschow. Firstly, thank you for your reply.

    Yes, I want the actuator to follow a sine wave form.

    My inputs are the amplitude and frequency The PID should control speed (RPM) of the motor. A transducer LVDT is feeding back linear position.

    I do not think the real position is near sine form. Peaks are usually higher than the sine set point.

    As I do not have experience in control, I thought the PID would not aplly to my case.
     
  4. rbpassos

    Thread Starter New Member

    Mar 22, 2015
    8
    0
    The real problem I am facing is that the position (green line) and the control (red line) are not sinusoidal, although the set point is (white line)


    Captura de tela 2015-03-23 12.33.01.png
     
  5. crutschow

    Expert

    Mar 14, 2008
    12,991
    3,226
    The control signal won't necessarily be sinusoidal since it is trying to do whatever is needed to keep the movement sinusoidal also.
    Show your complete circuit.
    So what have you done to tune the PID in your system?
     
  6. GopherT

    AAC Fanatic!

    Nov 23, 2012
    5,991
    3,736
    This looks more like P control. You need to adjust the importance of P, I and D ("tuning"). There is a co-efficent that you need to enter for each. You can look at over-shoot, error and tracking. You track fairly well but with a time lag (error = integral). You are also overshooting your target (d/dt = derivative). Increase the coefficients (gain) of I and D.
     
  7. rbpassos

    Thread Starter New Member

    Mar 22, 2015
    8
    0
    Mr. crutschow.
    Thank you for your help.

    You are right. I should not expect sinusoidal wave form for control signal.

    Following my complete loop.

    To tune the PID what I have been doing is the following:
    1) Eliminate de I and D gains;
    2) start with small Kc gain;
    3) give a STEP perturbation to the system;
    4) increase the Kc till the response is oscillatory with constant amplitude.
    I read this would be Ziegler-Nichols tuning, but really dont know if apply to my case, cause my system never reach the set point in oscillatory motion.
    block_diagram.jpg
     
  8. rbpassos

    Thread Starter New Member

    Mar 22, 2015
    8
    0
    Dear GopherT,
    I am starting with the Ziegler-Nichols tuning to figure out P, I and D gains. I proceed with your recommendations and what I get better is the following.

    The time lag error is not a problem to me, because I have sufficient time to star acting, and so I would send the control signal in advance.

    What I really want in my application is a Process Variable tha is more near the sine form than I reaching by now.
    If anyone has any suggestion, please feel free.
    Thanks.

    Captura de tela 2015-03-23 17.15.14.png
     
  9. t_n_k

    AAC Fanatic!

    Mar 6, 2009
    5,448
    782
    Zeigler-Nichols is a heuristic method of controller tuning and works effectively with certain systems. Such as first order lag plus transport delay (dead time). There's no guarantee it will produce optimum performance.
    Have you considered developing a system transfer function model from experimental data? You may obtain better performance if you have the transfer function and use that as the basis of the overall control design.
     
  10. rbpassos

    Thread Starter New Member

    Mar 22, 2015
    8
    0
    You mean input a sine wave control and measuare the output in a open loop?
     
  11. t_n_k

    AAC Fanatic!

    Mar 6, 2009
    5,448
    782
    Along those lines.
    Initially focussing on the "plant" open loop TF. You could presumably do a amplitude-phase response vs frequency using sinusoidal stimulus to the open loop plant.
     
  12. GopherT

    AAC Fanatic!

    Nov 23, 2012
    5,991
    3,736

    Check your equipment, it looks like you may have a sensor that is not fastened tightly and it is bouncing as the actuator reaches its end - that may be why you are seeing a double peak instead of sign-looking wave.
    upload_2015-3-24_9-32-6.png

    Also, in your tuning of PID, it looks like P is ok for now. So, start adding gain to the D, this should cause the actuator to slow down before it gets to the end point. Keep adding gain until you stop getting the overshoot. It will also help soften the vibration at the end of the stroke if you cannot secure your sensor better (assuming it is loose).
     
  13. rbpassos

    Thread Starter New Member

    Mar 22, 2015
    8
    0
    Thanks for your advices.

    I fixed better sensor to actuator, that wasnt the problem.

    I tried to give more gain to D, but did not solve iether.

    But since I REDUCED the sample frequency from 100Hz to 40Hz my wave form became significatly better.

    May that be a resonable solution to control?

    reducedFS.jpg
     
  14. rbpassos

    Thread Starter New Member

    Mar 22, 2015
    8
    0
    Now I start thinking that the improvment in sine form is due to the reduction of noise, since I reduced sample frequency.
    Until now I wasnt using an analogical filter, only the digital one inside the rotine.
    I am thinking of build one.
     
Loading...