Sign in to follow this  
Followers 0
Linhvct

PID Instruction in Functio block area

5 posts in this topic

Dear Automation Guy ^_^ I've been starting written a CJ1-PLC's program, because it's a very big complex program, I want to put all the repeat tasks into function blocks in order to make the program easy to read and debug. In one function block that uses PID instruction, I found that the result word was always zero, as shown in the pic that attached below. In this function block I defined some variable as below: 1. PID_CW : internal variable, data type is WORD, Array size is 39 PID_CW[0] = Setpoint PID_CW[1] = Proportional Band = 5% PID_CW[2] = Intergral parameter = 20 PID_CW[3] = Derivative parameter = 40 PID_CW[4] = Sampling period = 20 PID_CW[5] = #2 (0000 0000 0000 0010) = reverse control, enable changing PID parameter each sampling period PID_CW[6] = #0505 = number input/output data bit is 13, 0-1FFF Hex (0-8191 Dec) range. 2. Var3 : internal variable, data type is UINT (content PV value) 3. Var4 : internal variable, data type is UINT (Result word of PID Instruction) Setpoint and PV is converted to 0-8191 Dec Range before execute PID Instruction. I can find where it's wrong. Hope you can give the anwser why does the result of PID instruction in this case is always zero? Thank you! With kind Regards! Edited by Linhvct

Share this post


Link to post
Share on other sites
PID dont work in Simulator, if it is how you test it. If not, can you post your FB?

Share this post


Link to post
Share on other sites
Oh really!? That's it! Thank you :) I have just read in PID Instruction help that PID is not alowed in function block area, I wonder what it means? Have you ever use PID in a function block successfully? It's very tired to start writting code over again :( Edited by Linhvct

Share this post


Link to post
Share on other sites
PID do work in FB, i said it doesn't in CX-Simulator.

Share this post


Link to post
Share on other sites
Thank pfort, your information is very useful.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0