cpt invalid tag/expression

khewes

Member
Join Date
May 2016
Location
New Hampshire
Posts
123
hello,

Using rs logix 5000 i am trying to calculate the radius of a circle given x,y values...

i am getting the error invalid tag/expression in a cpt function

all of the variables used are REAL types

please let me know where i go wrong


i see i have a parentheses error, i fixed that and still get the invalid error

Capture.PNG
 
The most likely syntax error is the "/" in the (1/2) you need to use the Pipe symbol for division "|". It is the symbol you get with keyboard {shift} + {\} above the {enter}.
side note why not use 0.5 instead of 1/2.
 
In RSLogix 5000, "x power of y" is written like x**y.

About the division sign, "/" is ok. The pipe symbol applies for RS500.
 
now that you seem to have it working – here's something that you might find "interesting" ...

first assign some realistic values to your "input" variables – then use a STANDARD CALCULATOR to double-check the results that you get from your CPT calculations ... make sure that the results from the ControlLogix are "close enough" to what you're expecting to get ...

here's the point ...

PLCs do not perform calculations on REAL numbers (those with decimal points) in exactly the same way that a standard calculator performs them ... in simple terms, there is often (USUALLY?) a loss of precision involved ... in some cases, this loss of precision doesn't amount to a molehill – but in other situations, it can be a VERY big deal ...

try this quick little experiment ... just set up a "junk" tag as a REAL ... now type in the following value:

123456789

now take a look at the results and you'll find 123456792 – which is "off by 3" from the original value that you typed in ...

true – being "off by 3" in a number as big as the one you typed in might be just "peanuts" in the grand scheme of things – but the fact is that the value is DIFFERENT than what most folks would expect to see ... and for some types of processes, that unexpected DIFFERENCE can turn into quite a bit of excitement during startup – and during debugging – and even later on during runtime ...

also consider that in a calculation such as the one that you're working with, a slight loss of precision in one factor of the calculation – might conceivably interact with a slight loss of precision in another factor of the calculation – and the combined "snowball" effect might conceivably turn into quite a large error in the final results ...

in closing, you might already have been aware of this – so feel free to ignore this post completely ... but please also consider that other readers in the future might NOT have been aware of this type of little "bump in the PLC's mathematical road" – so I'll post this information in an effort to help them along the way ...

best of luck with your project ...
 
Last edited:

Similar Topics

I am using the following formula and I am getting error, Invalid Expression - too many closing parenthesis. when i copy the formula to notepad or...
Replies
4
Views
160
In the CPT in rung 2, i'm having an issue where if there is any value less than 0.0115 in "verticalSpeed", "festoonPosition"'s value does not...
Replies
3
Views
1,118
I have ran into something I have not seen before and wondering if any one had any ideas. The logic I'm currently troubleshooting is using a...
Replies
3
Views
1,664
so I have to find the standard deviation for amperage readings at my plant. when I input the formula into the CPT instruction it is automatically...
Replies
7
Views
1,856
Hello, I am having trouble with the CPT in RSLogix 500, with a ML1400. At first I had everything in one equation, it gave me the Source and...
Replies
5
Views
2,031
Back
Top Bottom