PID Analog controller

ermanas
2016-11-14
2018-07-23
  • ermanas - 2016-11-14

    Hi all;

    I read the related posts on board but it seems to be there is no any subjects related to this.

    We are building a line follower robot using TURCK's PLC with codesys V3.5sp8.
    I want to use PID control function block for line follower to minimize the mistakes but I couldnt understand how to commission it.

    I read analog value from line follower camera between -10V...0V...+10V in PLC like -32767...0...32767
    And I send this to steering servo analog speed Input directly. (by doing some basic math)

    I dont know how to commission PID or PD function block on both analog input and analog output.
    Or maybe I should use another block like Hysteresis?
    Can anyone give me any advise about it or give me any example about commissioning PID block?

    Actual = "read_from_line_follower_cam"
    SET_POINT = ???
    KP = ???
    TN = ???
    Y_OFFSET = ???
    Y_MIN = 1000
    Y_MAX = -1000
    MANUAL = "man_button:=BOOL"
    RESET = "reset_button:=BOOL"

    Any help would be great.
    Thanks in advance

     
  • lukbok - 2016-11-14

    Hi guy,

    You have to read about PID controllers but imho you should scale input from -32767..32767 to 0..32767.
    Your analog output has less resolution then input so you can do it in this way.

    In attachment i am sending example of using PID block.

    Lukasz

    Onl.pdf [185.32 KiB]

     
  • mechbaral - 2018-07-20

    lukbok hat geschrieben:
    Hi guy,
    You have to read about PID controllers but imho you should scale input from -32767..32767 to 0..32767.
    Your analog output has less resolution then input so you can do it in this way.
    In attachment i am sending example of using PID block.
    Lukasz

    Hi I tired the setup for temperature it does not stop at setup value rather than it goes on decreasing to negative if the output after sub function is ActualTemperature so i changed the value and checked there is no output from the PID the only thing i can see is the value is subtracted on every cycle by 0.1.
    Can you please explain the working
    [img][img][/img][/img]

    IMG: Screenshot_4.png

     
  • alwoso - 2018-07-20

    Hi ermanas,

    You did not give "KP", "TN" or "TV" values to the input parameters. But these are the necessary values for closed loop control. Try Some values there, and you will see the result

    Just one little question: Did you define "outputafterlimit" as a REAL variable? If you have an INT, you always will see only 0 or 1 at the output......

    Good luck!
    Alfred

     
  • mechbaral - 2018-07-21

    alwoso hat geschrieben:
    Hi ermanas,
    You did not give "KP", "TN" or "TV" values to the input parameters. But these are the necessary values for closed loop control. Try Some values there, and you will see the result
    Just one little question: Did you define "outputafterlimit" as a REAL variable? If you have an INT, you always will see only 0 or 1 at the output......
    Good luck!
    Alfred

    HI,

    Thank you for your reply, I have given the value of the Kp TN and TV too actually i gave the value while defining the variable so we cannot see there. I have attached the image.

    IMG: Screenshot_5.png

     
  • alwoso - 2018-07-23

    OK,

    the same settings are working fine in my test program (just using a ControlWin PLC).....

    No more ideas

    Good luck

    Alfred

    IMG: PID_Ctrl.png

     

Log in to post a comment.