Announcement

REXYGEN forum has been moved. This one is closed.
Head over to the new REXYGEN Community Forum at https://forum.rexygen.com.

Looking forward to meeting you there!
 

#1 2016-10-14 13:27:38

rexpeter
Member
Registered: 2016-09-06
Posts: 67

Math function: round to xx decimals

Is it possible to round a decimal value to the number of digits you would like to have or display?
So instead of reading "25.12345" making a calculation to display one decimal place "25.1" or 3 decimal places "25.123" etc.
The ROUND function does not provide any decimal position, so you would get just "25" and that is not what I would like to have.

Thanks in advance,
Peter

Offline

#2 2016-10-14 14:32:06

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: Math function: round to xx decimals

Hello Peter,

please, can you specify where exactly do you want to round the numbers? Is it just for displaying during online monitoring or display in HMI? Or would you like to "trim" some of the signals directly in Rex and continue to process the rounded values?

Best Regards, Tomas

Offline

#3 2016-10-14 16:23:03

rexpeter
Member
Registered: 2016-09-06
Posts: 67

Re: Math function: round to xx decimals

Hi Tomas,

Factually I would like to display it on HMI with just 1 or 2 decimal positions. I prefer to work with accurate numbers in the algorithm, but for the display it would be nice to trim it.

Offline

#4 2016-10-14 17:05:36

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: Math function: round to xx decimals

Hi Peter,

I presume that you are using RexHMI Designer based on Inkscape, am I right?

If so, select the display in RexHMI Designer and press Ctrl+E (or Extensions --> RexHMI --> Edit Element).
Switch to "Options" tab and there is parameter "decimals".


display_precision.png

I hope the above is useful to you. Feel free to contact us if you have any other questions.

Cheers, Tomas

Offline

#5 2016-10-14 17:55:11

rexpeter
Member
Registered: 2016-09-06
Posts: 67

Re: Math function: round to xx decimals

Hi Tomas?

Honestly said I did not used the Inkscape yet? But the simple WebUibi? Interface. And there is to my opinion no possibility to trim this formatting. Therefore I hope it can be done in the algorithm.
If not, I have to start learning and using RexHMI.

Offline

#6 2016-10-14 18:16:14

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: Math function: round to xx decimals

Peter, sorry for my assumption about the HMI you are using.

In case of WebBuDi you can also use parameter "decimals":

{type:"AW", ... , "decimals":2}

Regards, Tomas

Offline

#7 2016-10-15 14:48:14

rexpeter
Member
Registered: 2016-09-06
Posts: 67

Re: Math function: round to xx decimals

Thanks a lot Tomas!

Offline

#8 2016-10-17 06:40:44

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: Math function: round to xx decimals

You are welcome, Peter. Good luck with your project!

Tomas

Offline

Board footer

Powered by FluxBB