Sign in to follow this  
Followers 0
308guru

Another SCP command question

14 posts in this topic

Please see this post if you want a little history on my previous SCP command question. http://forums.mrplc.com/index.php?showtopic=10616 I now have another question as I venture into different applications and equipment. I want to make sure I understand how to set up the input min and max. From what I understand, these values are based solely on the resolution of the plc or card the input is coming into. As an example, my ML1100 has 10bit analog inputs. Using 2^n-1, My min/max is 0-1023. Does it follow then to say: 12 bit would be 0-4095 16 bit would be 0-65536 I also have a 1762-IF2OF2 card which is 12 bit. Should I be using the 0-4095 for that? That however, doesn't jive with the specs on the 1762-IF2OF2 (pub. 1762-IN005A-US-P page 14) stating that Raw/Proportional data is 0-32760. Can somebody shed a bit of light on this for me. Thanks for any help.

Share this post


Link to post
Share on other sites
Yikes! Well a big part of this lies in what has been selected on the "I/O Configuration" under the "Analog Input Configuration" tab; under the "Input Range" and and "Data Format". To be sure I like to set it all up and then force the inputs and go online and watch the values. If I'm running 4-20ma inputs, I force the input to 4 and write the number down then force it to 20 and Write it down. A 1762-IF4 is 0-16383 if setup as a "4-20 ma" and a Data format as "Scaled for PID" A 1762-IF2of2 is 3112 to 15584 when set up the same way. If I remember right the If2OF2 is 0-16383 at 0-21 ma. Go figure. Edited by finfin

Share this post


Link to post
Share on other sites
Apparently the "Scaled for PID" selection cause it to give a 0-16383 output (I guess the resolution isn't there, but it is just internally scaled up to 16383). The trick is on page 18 of the little booklet that came with the IF2OF2 card, where it says; "Full Scale Analog Ranges"-- "Current: 0 to 21mA". If 0 is 0mA and 16383 is 21mA then 4 mA is 3120 and 20 mA is 15603. the numbers I mentioned earlier just worked better when I forced the inputs with a source driver.

Share this post


Link to post
Share on other sites
See PDF below. ( ansewer no. 2) ADConverter.pdf

Share this post


Link to post
Share on other sites
That probably explains why the numbers that I get as an input when forcing 4 or 20 mA are not exactly as I calculated in the second post. However when you force the input, with a trusted 4 mA and 20 mA source, The input value "is what it is", making these values the correct values to use in a scaling command. These have always worked fine for my measurements. If you need 1/10th degree accuracy from a 0-400 degree 4-20mA input sensor, this card would not quite have the resolution you need.

Share this post


Link to post
Share on other sites
Pardon my lack of knowledge, but I don't think any of this helps me. Could somebody explain in simpler terms how the SCP command should be set up based on different resolutions of card/plc? Thanks.

Share this post


Link to post
Share on other sites
Sure... tell me what card, and Input configuration and I'll post the SCP settings.

Share this post


Link to post
Share on other sites
I appreciate the help. I guess it's taken me quite some time to reply here. Here is the hardware we are using. If you could suggest the setup parameters I would really appreciate it. - ML1100 base analog (10bit) (1023 chunks?) - 1762-IF2OF2 (12bit) (4095 chunks?) - 1769-IF4 (14bit) (16383 chunks?) - 1769-IF8 (16bit) (65535 chunks?) Thanks!

Share this post


Link to post
Share on other sites
You put the source minimum and maximum values in. Then you put your desired inputs for those same values into the engineering units. The source value is the raw input, and the result is the scaled output. For example, let's say you have a pressure sensor reading 0-1000 PSI, outputting 4-20mA, to an IF2OF2 card. According to the manual, 4 mA is 3120 and 20 mA is 15603. So those are your raw input minimums and maximums. You put "0" and "1000" in the engineering units minimum and maximum. The output will now be scaled from 0-1000 PSI, when the input goes from 3120-15603. The SCP command is easier but if you prefer doing the math yourself, then use the SCL command. The "rate" is another word for "slope" or m, in the conventional equation form of Y=mX+B. The offset is B. Note that the rate is automatically scaled by 10,000 so multiply your scale factor by 10,000 when you plug the number in. This command is much older and goes back to the first couple versions of the SLC which did not have floating point math. For example, the slope in this case would be (1000-0)/(15603-3120) = 0.08011. Multiplying by 10,000 gives us a rate of 801. The offset is then -0.08011*(3120)=-250. If you wish, you could also load this all into a CPT block. The CPT block expression would be 0.08011*(raw value)-250. The SCL command is essentially just a pre-written CPT function and a holdover from 20 years ago. As you can see, there's a lot of math involved and you can't check a SCL command "by inspection". An SCP command just takes the raw numbers and does it for you. On a PLC-5, you either set the scaling on the I/O card, or you have to use the CPT method. On a CLX, which has both the SCP and CPT instruction, AND scaling on-card, I rarely see anyone using any method other than setting up the engineering units on the cards themselves because this is so trivially easy to do with a CLX processor.

Share this post


Link to post
Share on other sites
paulengr, Could you tell me where you got the 3120 and 15603 values from? I looked in the IF2OF2 installation instructions and the ML1100 users manual and I couldn't find that info. Maybe I missed it. I was under the assumption that the input values were strictly based on the resolution of the device. 10bit = (2^10)-1 = 1023 12bit = (2^12)-1 = 4095 14bit = (2^14)-1 = 16383 16bit = (2^16)-1 = 65535 with zero being the min input and one of the above values being the max. Not so?

Share this post


Link to post
Share on other sites
Your answer isn't very helpful and not all that friendly to someone trying to learn. You may know it all, but the reason I visit this forum is to ask questions, read, and learn. I didn't see any prerequisites of experience before posting anywhere. Remember, you started with no PLC knowlwedge at some point too. It's easy to say "do the math". I can do the math. I am interested in where the numbers come from and why are they the values they are. Maybe somebody else can actually help. How are these numbers determined? Are they derived somehow and based on the resolution, or are they manufacturer determined? The IF2OF2 is a 12 bit card. That means the span is 4095 "pieces" of data. Am I wrong with this thinking? It seems that others have suggested using numbers based on resolution is the reason I am asking. I have conflicting information. Where did the posted image come from? I couldn't find that chart in my manuals, but like I said, I may have missed it.

Share this post


Link to post
Share on other sites
I think the 12-bit resolution refers to the A/D converter in the module itself. What you are concerned with as a programmer are the scaled values between the processor and the module. In the manual, MicroLogix 1100 Programmable Controllers Bulletin 1763 Controllers and 1762 Expansion I/O (Publication 1763-UM001B-EN-P - April 2007), on page 181, there is a table titled “Valid Input/Output Data Word Formats/Ranges for 1762-IF2OF2.” The module can be configured for either RAW scaling or Scaled for PID. For both forms of scaling, the valid signal range is 0-21mA. If using RAW scaling, the 0-21mA signal corresponds to a range of 0-32760. “Doing the math,” you get (4/21)*32760 = 6240, which is what the table shows is the RAW value for 4mA. Likewise, (20/21)*32760 = 31200, which is what the table shows for a 20mA signal. If using Scaled for PID scaling, the 0-21mA signal corresponds to a range of 0-16380. Then you get (4/21)*16380 = 3120, which is what the table shows is the Scaled for PID value for 4mA. Likewise, (20/21)*16380 = 15600, which is what the table shows for a 20mA signal.

Share this post


Link to post
Share on other sites
Thanks for the reply ScottC ! I'm getting it now. One last question. Why are there two different sets of values depending on RAW or Scaled for PID? How do you determine which one to use and why are they different. I'm not using my analog inputs for any PID loops so I would guess that leads me to set it to RAW. Aside from that, I don't know how to make that decision though. Thanks.

Share this post


Link to post
Share on other sites
"Scaled for PID" is specific to the SLC-500 family PID instruction. The PID instruction was developed for the SLC-5/02 controller, way back before the SLC's supported floating-point math, so it is an integer-only instruction. The values for the Process Variable and Control Variable can be between 0 and 16383. Think of the "Scaled for PID" as meaning "Scaled for the SLC style integer PID instruction data range". Since you're not using the PID instruction, go for normal Raw data and scale it yourself.
1 person likes this

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