Sign in to follow this  
Followers 0
1292dem

Omron Decimal/Math issue

6 posts in this topic

Hello Folks, Been an on/off forum reader for some time now....this is my first post. My apologies if I post in the wrong area... I'm using a CJ1M/CPU23 platform with CX-One software. Here is my challenge: to capture H20 in ml (xxxx) dispensed over time in secs (xxx.x) and displaying this result as xxx.x ml/sec on an NS8 screen. I can get it to work with out the the decimal but after that the code breaks. I have tried several different instructions and can't seem to get the reults I need. The math is fairly simple H20/time = ml/sec. Not looking for a handout just trying to understand where my mistake(s) are so I can further learn from them. I will be truley greatful for any help provided!!! Thanks again :)

Share this post


Link to post
Share on other sites
What do you mean the code breaks? There are numerous ways to achieve decimal place accuracy; 1. Some present the value as a multiple of 10 in the PLC, then in the HMI, divide by 10, and display a decimal place. This is the way it has to be done in the older processors 2. Use floating point math, this is the better way IMO, but there are tricks you need to watch out for. Since you are using a CJ1, you should be able to use Floating Point, that is what I would be doing. If you can post what you have done so far & a bit more about how the ml is recorded, we can have a look and correct do get you going. From the sounds of it, you want to know how much H20 has been dispensed after so many seconds? You must have some sort of flow totaliser coming in?

Share this post


Link to post
Share on other sites
You need to apply Unit&Scale to your Numeral Display on the NS8. There is already a single decimal point value in the Unit&Scale table.

Share this post


Link to post
Share on other sites
Not to familiar with floating point math, never had to use it...I probably should have been more specific what I'm after as far as the code goes. Were not using a flow totalizer to capture the mls, just using a beaker to dispense into, valve opens at a constant pressure/flowrate (not measured & locked out) and we count how much time it took to fill the beaker, enter how much mls were dispended into the beaker on the screen then the math is done to determine how much was dispensed over time in . Any ideas on how to make this work???

Share this post


Link to post
Share on other sites
Not really that simple. As the division result is fractional, you should decide, how many decimal positions you need in the result. Then you should decide whether truncating after this decimal is OK or you need mathematically correct rounding, in which case the latter must be programmed additionally. The calculations themselves may be done in either integers or floating. Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
Hi Hop you are well, did you get an answer for this question yet?

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
Sign in to follow this  
Followers 0