Troubleshooting String Comparison Issues in Studio 5000 PLC Software

Question:

I have encountered a strange issue while attempting to compare strings in Studio 5000 on an Allen Bradley 1769-L33ER PLC. Both strings are not being saved anywhere else, but the comparison is not working as expected. Could there be a different command that I should be using for comparing strings effectively in my program?

Top Replies

It appears that the correct controller tag is being used. To confirm, I would need to review the controller tags. It seems that the third branch may have a data array with no value and a non-zero value in LEN. This is just a preliminary observation, as I am unsure of the expected value.

Sinor expressed concerns about comparing strings in Studio 5000 with an Allen Bradley 1769-L33ER PLC system. Upon encountering an incorrect string comparison, Sinor wondered if there may be a need for an alternative instruction to carry out the task effectively. The issue seemed puzzling as neither string was assigned elsewhere. Reviewing attachment 69970 did not bring clarity to the situation. What could be causing this confusion? It appears that assigning an actual value to barcode 3 could be the solution.

Sinor inquired about comparing strings in Studio 5000 on an Allen Bradley 1769-L33ER, noting a strange incorrect string comparison. The strings in question are not being written elsewhere. Is there a different instruction required for comparing strings? The specific query relates to the value of Barcode_String[3] during the evaluation of the third EQU instruction, following the XIC toggle[3] branch. If there are no additional branches beyond those visible in the provided image, it is highly likely that the value of Barcode_String[3] at that evaluation moment is 'S1234000107'.

When troubleshooting a barcode issue in your program, ensure that Barcode_String matches Barcode_Program[3] as intended. The discrepancy may stem from inactive instructions disabled by toggle XIC instructions on the rung. Verify and assign an actual value to Barcode 3 to resolve the issue.

According to dmroeder, it seems like the controller tags on the third branch may have a zero value in the data array and a non-zero value in the LEN, but without seeing them it's just a guess. It's unclear what specific value you are anticipating. It's worth noting that even a null or zero value should be considered valid for comparisons.

It sounds like you're running into a common issue with string comparisons in Studio 5000. Instead of using a simple equality comparison, try using the 'StringCompare' instruction, which is specifically designed for comparing strings and can handle various scenarios more effectively. Make sure to check for any leading or trailing spaces, as those can also throw off your comparisons—even if the visible content looks identical.

It sounds like you're running into some quirks with string comparisons in Studio 5000! Instead of using the standard comparison commands, you might want to try using the `LEN` function to ensure both strings are of the same length before comparing. If there's a mismatch in Length, the comparison will likely fail, which can be misleading. Also, make sure there are no hidden characters or spaces affecting the comparisons; sometimes using functions like `TRIM` can help clean things up. Good luck!

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: FAQs:

Answer: 1. Why am I encountering issues when comparing strings in Studio 5000 on an Allen Bradley PLC? - The issue may be due to the way strings are being compared or saved in the program. Double-check your comparison logic and ensure that the strings are being handled correctly in the PLC software.

FAQ: 2. Is there a specific command recommended for effectively comparing strings in Studio 5000?

Answer: - While there isn't a specific command dedicated solely to comparing strings in Studio 5000, you may want to review your existing comparison logic and consider using functions like STRING_COMPARE to ensure accurate string comparisons.

FAQ: 3. What steps can I take to troubleshoot string comparison issues in Studio 5000 PLC software?

Answer: - To troubleshoot string comparison issues, verify that the strings are correctly formatted, check for any potential differences in case sensitivity, and ensure that the comparison operation is performed accurately within your program logic. Additionally, consider debugging tools or simulations to test and identify the root cause of the problem.

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  â†’