Jump to content

Recommended Posts

Unitronics Vision ver. 9.8.65 build 0

Hi, everyone.

Faced the problem of floating point numbers. I tried to find a solution on my own - it didn’t work out. When outputting a floating point number to the HMI using the numeric indicator, at certain times the number goes beyond the indicator boundaries and is layered over the image, although this shouldn ’t happen. Image attached.

In the attached file, there are subroutines for processing the numeric indicator  variable 1 - MF24 (Flow_meter) and the variable 2 - 56 (Convert_ML_to_MF). At the same time, for the program " Convert_ML_to_MF " the signal comes from the weight module "IO_LC1" starting with ten thousand, comparable to grams, therefore the corresponding division. For the subroutine  " Flow_meter "   the impulse weight from the panel is set, for example  the process in the picture is set to 0.1, which is always multiplied by an integer. Аccordingly, there should never be more than one number after a point, the less it is.
Also, i have a video changing MF in motion, if someone want to see - i can send)

ec098b3e-af1b-4863-bebe-9b79fef0bdbb.jpg

Example.vlp

Share this post


Link to post
Share on other sites

I don't see a good reason for using floating point in your application. Just use integer with implied decimal. You can display an integer on screen with the correct number of decimal places. Just do integer math, keep track of where the decimal goes, multiply or divide by 10 (or 100, etc) as needed, and display it accordingly.

Share this post


Link to post
Share on other sites

Operator should be able to change the number of decimal places from HMI, and in the case of an integer type  with implied decimal, as I understand it, there will always be zero instead of empty space. Or i'm wrong? 
It's a good way to avoid the problem, but i have 19 similar programs in which the algorithms change a little and everywhere I used MF.  If no one has faced such a problem when using MF, then maybe I have an error somewhere. But if there is such a mistake and it isn't solved, then it should be announced about it.

Share this post


Link to post
Share on other sites
On 10/10/2018 at 7:20 AM, Bohdan said:

If no one has faced such a problem when using MF,

Unitronics is well aware of this "mistake". 

Everyone who has put MF values on a display has faced this problem in UntronicsLand.  I've run into the problem with competitor's HMI products as well.  The nature of a IEEE floating point value is you can't easily extract the location decimal point  and the number of significant for display.

image.png.58e928bb19ff4809acc80a9fdfae279a.png

True, you could theoretically  create an object that could extrapolate the decimal via code.  But then what would you do if the float became large or small enough that an exponent was required?  What if the exponent needed to be negative?  

Anyway, the Vision series has never promoted itself as a floating point powerhouse - you can tell because there are only 64 of this memory type.  Unitronics will not be improving this product line's functionality significantly - the focus is on UniStream now.

 

On 10/10/2018 at 7:20 AM, Bohdan said:

but i have 19 similar programs in which the algorithms change a little and everywhere I used MF. 

I feel your pain on this and have banged my head against that wall.  But the problem is still there.  I would advise you to go back and revisit the algorithms using MI's or ML's, especially if displaying the output value is required.

 

Joe T.

  • Like 1

Share this post


Link to post
Share on other sites

Give a look at the "num" to ASCII under the strings menu.

You can set an indirect position for the decimal place on the HMI.

It may help you achieve what you want.

  • Like 1

Share this post


Link to post
Share on other sites
On 10/14/2018 at 10:20 PM, sgull said:

It may help you achieve what you want.

yeah, it helped. This is the best way to solve this problem. Only in this case, if I need precision in integers (without characters after the decimal point and itself decimal point), it will still display "0" after the  decimal point . But i think customer will accept it)
Thanks for the advice!

Share this post


Link to post
Share on other sites
On 10/13/2018 at 11:03 PM, Joe Tauser said:

Anyway, the Vision series has never promoted itself as a floating point powerhouse - you can tell because there are only 64 of this memory type.  Unitronics will not be improving this product line's functionality significantly - the focus is on UniStream now.

Thanks for the detailed explanation! Maybe i will discover UniStream for myself soon, and i hope it has more functionality.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×