Jump to content

Another question about PID, APR, scaling


Recommended Posts

Posted
I am new to plc programming. Thanks in advance for helping me with this. This is a CJ2M cpu with a CJ1W-TS562 6ch RTD input. Temperature input is 16 bit cio word 4 and is a 16 bit signed integer in units of 0.1 C. #F830 = -200.0 C, #1964 = +650.0 C How do I setup a PID instruction using this input as a source word? I think the steps are; subtract #1964 from cio word 4, use APR to scale that to 12 or 16 bits, input that value to a PID, then use APR to scale the output of the PID to a usable range for output. Should I use 16 bit pid? What would be a good C+6 word? My code is attached. Oven PID test.cxp Am I doing this correctly or is there a better way?

Posted
Do you need to control temperature below zero? If not, I think the easiest thing to do would be to prevent the input to the PID from going negative (the PID takes an unsigned input) and set up the PID as 13bit in. The input should then be scaled to #1FFF max. If you only need a temperature range of 400 degC, you could set up the PID as 12 bit in without scaling. Geir
Posted
0-400C would be a good range. My next question is how to I take the 12 bit output of the pid to the CJ1W-DA041. I will work the code and post it.
Posted
Just MOV it from D43 to 20xx (the address of the DA module) Geir
Posted
I think the output module expects 16 bit binary data. Should I setup the PID instuction to input 12 bit data and output 16 bit data? Is that possible?
Posted
The DA041normally has a range of 0-4000 that would fit in 12bits (4096) Geir
Posted (edited)
In the manual for the DA041 it says two things about the data; 16 bit binary and 0000 to 0FA0 for 4000 resolution. So I would still need to use the APR instruction to scale the 12 bit output of the pid to a range of 0-4000 for the output? Or do I set the upper and lower limit of the pid output using c+7 = 0 and c+8 = 0FA0 and C+6 bit 12 = 1? Thanks for all the help Geir! Edited by Rabid
Posted
Here is a new program that cuts the range of the input to 12 bit and limits the pid output to 4000 resolution. Oven PID test 2.cxp

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
×
×
  • Create New...