cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Kepware Data Value Round Up

SA_10373213
7-Bedrock

Kepware Data Value Round Up

Hi, I am currently configuring some Advanced Tags in Kepware and I would like to round up some of the values that come up from the machines. For example, if it is 35.5 , round it up to 36 and ranging from 35.1 to 35.4, round it up to 35. Is there a way to do it?

 

What we are looking for is a function or formula to round up a number with standard procedure.

When it is 35.5,35.6,35.7,35.8,35.9, round it up to 36.

When it is 35.1,35.2,35.3,35.4 , round it to 35.

 

 

 

 

 

2 REPLIES 2

I do not know any solution with Advanced Tags. But if an OPC client is expecting the rounded data then you could use a combination of IoT Gateway(REST server) & Universal Device Driver(UDD) to achieve any pre-processing of data; in your case rounding the decimal places. For reference, you will find an example of pre-processing this way in the PTC Kepware GitHub page. Please pay attention to the disclaimer for the GitHub content.

An easier method would be to use Scaling. Assuming your tag data type is a float or double, if you select the Scaled data type to be one of the integer data types(for example Long or Short), then it is rounded off as per IEEE 754. This satisfies your rounding requirement. But please note as per this specification, 35.5 and 36.5 will both round off to 36. Please choose the values of other fields in this editor as per your requirement after referring the help documentation. 

 

rjanardan_0-1689585314675.png

 





Announcements


Top Tags