professor_jonny Posted June 17, 2019 Report Posted June 17, 2019 Hi I have flow meters and have them counting up to a value and stopping a pump. it all works but the display on the hmi counts up in decimal places because of the scale factor of the flow meters. To scale them because of inacuracy I basically multiply what I want to count to by 1000 and i basically add for every pulse of the flow meters a value between 1500 and 500 to count to scale the flow meters then compair the two to stop the pump if the count is equal to or greater than the dialed in amount. Is there an easy way to round this value to the nearest bigest 10's value? I'm guessing convert to a floating point use the FIXL instruction? is there an easy way im missing as I could not seem to find a rounding instruction? Quote
IO_Rack Posted June 17, 2019 Report Posted June 17, 2019 What screen are you using? If it is only for display, the NS screens will round the value automatically to the number of digits shown. FYI... the NS screens will also scale for you. Quote
professor_jonny Posted June 17, 2019 Author Report Posted June 17, 2019 I'm using a mixture of NB and NS screens currently and possibly in the future ignition scada. That is one option I guess but it is screen dependant and would be nice to do it in the plc. Quote
Berti Baker Posted August 12, 2019 Report Posted August 12, 2019 Hi, Here's a suggestion for the logic to use Add 5 (half of 10) to make the result to round up or round down Divide by 10 Convert to INT type to truncate. Multiply by 10 So 32 would become (INT((32+5)/10)) * 10 = 30 or 37 would become 40. Sorted? Regards, BB Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.