Implementing Fibonacci Sequence in Ladder Logic using TIA Portal V17: Need Help with Printing Decimal and Hexadecimal Results

Question:

Greetings, I am looking to implement a program in Ladder logic that involves integrating the Fibonacci sequence. I have successfully completed the task of adding the first two digits of a 11-digit ID number with 150. I now need assistance with printing the Fibonacci Number corresponding to the result in both Decimal and Hexadecimal formats on the screen. For example, if the ID Number is 42xxxxxxxxx, the term to be found would be the 192nd term (150+42). Please note that the basic Fibonacci sequence should be used for this calculation. I have already completed the initial steps mentioned above and would greatly appreciate your guidance on the remaining tasks. I am utilizing Tia Portal v17 for this project. Thank you in advance for your help.

Top Replies

Implement program control operations to execute a loop construct in ladder logic.

Thank you for your assistance. I'm unsure of how to incorporate a loop into this network. Could you please verify it for me?

Utilizing a loop may not be the most efficient solution. In the case where your identification number begins with 99, the 249th Fibonacci number (resulting from adding 99 to 150) is a large numeric value that may pose representation challenges in a PLC system. A more effective approach could involve storing the Fibonacci numbers from the 150th to the 249th position in two separate arrays of strings - one in decimal form and the other in hexadecimal form. By using the first two digits of the ID as the index for these arrays, the desired Fibonacci number can be retrieved. It is important to note that the addition of the offset of 150 is not always necessary if you are able to start with the 149th and 150th Fibonacci numbers and proceed from there. The exception to this would be when utilizing a one-step formula for direct calculation.

What is the deadline for the homework assignment? Have you recently acquired any new programming concepts for PLCs? Is this related to the topic of string manipulation within this section?

drbitboy inquired about the homework deadline and recent programming concepts explored in PLCs. Are these topics related to string manipulation? Explore further by clicking expand.

Hello there! It's quite an interesting task you've set for yourself. The Fibonacci sequence can indeed be calculated in Ladder logic, although it might be a bit challenging due to its iterative nature. To get this done, you will need a loop ladder rung to compute the Fibonacci numbers up to the 192nd term (depending on the ID). Then, you can use the TO_DINT and TO_STRING in-built Tia Portal functions to convert the term into Decimal and Hexadecimal respectively, and display both on the screen. However, please bear in mind that the 192nd term in the Fibonacci sequence is going to be a huge number! You might need to consider using Double Integer or Large Integer (if your PLC supports them) for the calculations. Good luck with your project!

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. How can I print the Fibonacci number corresponding to a result in both Decimal and Hexadecimal formats in Ladder Logic using TIA Portal V17?

Answer: To achieve this, you can continue building upon your existing program by implementing the logic to calculate the Fibonacci sequence and then convert the result to both Decimal and Hexadecimal formats for printing on the screen.

FAQ: 2. What is the significance of adding the first two digits of the 11-digit ID number with 150 in the context of finding the Fibonacci term?

Answer: Adding the first two digits of the ID number with 150 helps identify the specific term in the Fibonacci sequence that needs to be calculated. In the example provided (42xxxxxxxxx), the 192nd term is to be found (150+42).

FAQ: 3. Can you provide guidance on how to implement the basic Fibonacci sequence calculation in Ladder Logic within TIA Portal V17?

Answer: You can start by setting up the necessary variables to store the Fibonacci sequence values and then use iterative logic to calculate each term based on the previous two terms. This iterative process can be implemented in Ladder Logic to find the required Fibonacci term.

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