CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Tue Feb 19, 2019 3:23 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
 Post subject: PID Analog controller
PostPosted: Mon Nov 14, 2016 6:07 am 
Offline

Joined: Sun Nov 13, 2016 5:03 pm
Posts: 1
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


Top
   
PostPosted: Mon Nov 14, 2016 2:39 pm 
Offline

Joined: Fri Jan 09, 2009 11:30 pm
Posts: 3
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


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Fri Jul 20, 2018 10:23 am 
Offline

Joined: Fri Jul 20, 2018 3:48 am
Posts: 2
lukbok wrote:
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]


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Fri Jul 20, 2018 3:01 pm 
Offline

Joined: Mon Nov 03, 2014 7:15 am
Posts: 44
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


Top
   
PostPosted: Sat Jul 21, 2018 8:37 am 
Offline

Joined: Fri Jul 20, 2018 3:48 am
Posts: 2
alwoso wrote:
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.


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Mon Jul 23, 2018 7:47 am 
Offline

Joined: Mon Nov 03, 2014 7:15 am
Posts: 44
OK,

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

Attachment:
PID_Ctrl.png


No more ideas :(

Good luck

Alfred


You do not have the required permissions to view the files attached to this post.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited