Troubleshooting Exponential Calculation Error in Studio 5000

Question:

Hello everyone! It's been a while since I last posted here, but I'm in need of some assistance. I'm working on a differential pressure calculation in a L27ERM CompactLogix controller, which involves calculating the viscosity of water based on temperature. I'm using the CPT instruction to input values for A, B, C, and D. While I successfully obtained the correct exponential value for A, B, and C, I'm struggling with D. Instead of getting the expected value of -0.000005723952, I'm only getting the value I input. I suspect that the REAL value may not be of sufficient resolution. I even attempted this in structured text but encountered the same issue. Despite trying different methods, including using a constant value for D, I'm still unable to get the desired result. Any suggestions on what might be causing this issue and how to resolve it would be greatly appreciated. Thank you in advance. - Dave

Top Replies

Dave Steer inquired about the specifics of entering and obtaining values in the Studio 5000 IDE. Are you experiencing issues with entering a value and receiving a different value? It is important to clarify where you are inputting these values and where you are obtaining them from. Is the IDE currently in offline or online mode? Are the values displayed in the CPT instruction's expression parameter in offline mode, or are they the result of the CPT instruction's calculation in run mode?

drbitboy inquired about the discrepancy between the values entered and obtained during programming in Studio 5000 IDE. He asked whether the IDE was in offline or online mode when entering and retrieving values. Additionally, he sought clarification on whether the values displayed were retrieved from the CPT instruction expression parameter in offline mode or from the calculation result in run mode. Apologizing for the confusion, drbitboy explained that he was working online with the processor in run mode, referencing calculations provided in an Excel spreadsheet. By using CPT instructions, he inputted specific expressions to obtain desired values. While most values aligned with the spreadsheet, one value D resulted in an incorrect calculation due to a decimal resolution issue. Attempting to adjust the decimal places, drbitboy encountered challenges in maintaining accuracy for the final equation, potentially attributed to a lack of resolution in the PLC system's decimal handling.

Apologies, it is indeed Studio5000.

Are you suggesting that the value -5.723952E-06 differs from -5.72395220E-006, causing the issue you're facing?

According to drbitboy, are you suggesting that there is a discrepancy between -5.723952E-06 and -5.72395220E-006? The issue at hand seems to be related to the output, as -5.723952E-06 should translate to -0.000005723952.

Hi Dave, it does sound like you're experiencing a precision issue. The REAL data type in CompactLogix controllers only supports six decimal places of precision. Given the expected value you mentioned for D has eight, this could be the reason you're not attaining your desired result. You might want to consider using the LREAL (extended precision real) data type instead, which offers up to fifteen decimal places of precision. Please ensure to adjust your code accordingly to accept LREAL instead of REAL. It might initially seem like a tedious switch, but it should help solve your problem. Please keep us posted on your progress. Good luck!

Hi Dave, I see where you're coming from. When dealing with significant figures, sometimes precision can be an issue. It's possible your result is being truncated because the REAL type only supports up to 7 digits of precision in CompactLogix. Calculations involving very small or very large numbers often encounter this kind of problems, because floating-point representations can't store all possible real numbers precisely. You might want to try changing the data type setting to DOUBLE, which supports a much higher precision and might solve your issue. I hope this helps. Good luck with your calculations!

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

✅   Work Order Management

✅   Asset Tracking

✅   Preventive Maintenance

✅   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

To add a comment, please sign in or register if you haven't already..   

Frequently Asked Questions (FAQ)

FAQ: 1. Why am I experiencing an error when calculating the exponential value for parameter D in my differential pressure calculation?

Answer: Answer: The issue you are facing with parameter D could be related to the resolution of the REAL value. It is possible that the precision of the REAL data type is affecting your calculation.

FAQ: 2. How can I troubleshoot the discrepancy in obtaining the expected exponential value for parameter D in my calculation?

Answer: Answer: To troubleshoot this issue, you can try verifying the data types and resolutions being used in your calculation. Additionally, double-check the input values for parameter D and ensure they are correctly assigned in your program.

FAQ: 3. Are there any specific considerations to keep in mind when working with exponential calculations in Studio 5000 or CompactLogix controllers?

Answer: Answer: When working with exponential calculations in Studio 5000 or CompactLogix controllers, it is important to pay attention to the precision and resolution of your data types, especially when dealing with small exponential values like -0.000005723952. Ensuring proper data type handling and precision can help prevent calculation errors.

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  â†’