7/14/2023 11:53 AM | |
Joined: 3/30/2020 Last visit: 9/6/2024 Posts: 4723 Rating:
|
What you are touching on is a reoccurring theme on this forum. It has more to do how the REAL number representation works and less about the PLC. Some link to look at: How do you check real numbers for parity? Otherwise search within this forum for expanded discussions. |
Activities of this user is voluntary. There is no obligation or liability placed on this user. Though optional, your 'please' and 'thank you' is highly valued. |
|
7/14/2023 1:30 PM | |
Joined: 9/27/2006 Last visit: 9/4/2024 Posts: 12282 Rating:
|
Hello HarrY; This is maybe not the full crack that you are hoping for, but it might give you a few leads to overcome the issue of REAL comparisons. https://support.industry.siemens.com/cs/ca/en/view/24000326 Hope this helps, Daniel Chartier |
7/14/2023 1:41 PM | |
Joined: 3/30/2020 Last visit: 9/6/2024 Posts: 4723 Rating:
|
|
Activities of this user is voluntary. There is no obligation or liability placed on this user. Though optional, your 'please' and 'thank you' is highly valued. |
|
7/16/2023 5:50 AM | |
Joined: 3/30/2020 Last visit: 9/6/2024 Posts: 4723 Rating:
|
To push this point a little further - 0.03 cannot be represented exactly with a REAL number. The following has been sourced from [LINK: IEEE-754 Floating Point Converter]. These are the closest two representations of 0.03. Note that when monitoring online with Step7, some reprocessing of the numbers may happen. You may see a 'filtered' representation. It is best to view the numbers in hexadecimal representation when hair splitting is required. When getting a result from a calculation, the error in representation grows. This is evident to what is demonstrated in the original post. Another trap that many fall into, especially when implementing totalizers.
There is a relative big difference between the two numbers that are added together. |
Activities of this user is voluntary. There is no obligation or liability placed on this user. Though optional, your 'please' and 'thank you' is highly valued. |
|
This contribution was helpful to
1 thankful Users |
Follow us on