Hi!
I'm currently doing a project on DeltaV, and the fract function in my code does funny things.
I have a measurement in MWH which can be eithe a whole number or have 3 decimal places. For example the value of 299.645 MWH is displayed as 299 MWH and 645 KWH. I used trunc and fract functions to separate these into MWH and KWH.
The issue is, when I write a number which decimal place ends with 1-5, the value displayed in the KWH section becomes off by one and the same happens sometimes when I use a random combination of numbers.
For example when I chose the value to be 299.3 MWH it displayed 299 MWH and 299 KWH or when the value was 856.358 MWH it was displayed as 856 MWH and 357 KWH.
The code works correctly most of the time, but some times it gives me a value of KWH which is off by one. Can someone please help me fix this issue?
Many thanks,
Olga
I'm currently doing a project on DeltaV, and the fract function in my code does funny things.
I have a measurement in MWH which can be eithe a whole number or have 3 decimal places. For example the value of 299.645 MWH is displayed as 299 MWH and 645 KWH. I used trunc and fract functions to separate these into MWH and KWH.
The issue is, when I write a number which decimal place ends with 1-5, the value displayed in the KWH section becomes off by one and the same happens sometimes when I use a random combination of numbers.
For example when I chose the value to be 299.3 MWH it displayed 299 MWH and 299 KWH or when the value was 856.358 MWH it was displayed as 856 MWH and 357 KWH.
The code works correctly most of the time, but some times it gives me a value of KWH which is off by one. Can someone please help me fix this issue?
Many thanks,
Olga