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 ...