JEFG Posted April 10, 2013 Report Share Posted April 10, 2013 Hi everyone, I have a pretty easy to answer question for most of you: I'm developing a program in wich an operator writes in a v130 the quanity of m3 of concrete wich are gonna be produced in a little plant. The idea is that the operator writes these m3 in a Display in a variable numeric field, which willl have the format: 3.2 (999.99 m3). I need to process this number to set the number of batches (mixes) of the plant, due to this plant has the capacity to produce only 1 m3 batch at time. So if for example the operator wants to produce 2.25 m3 of concrete, the number of batches will be 3. I need you to help me about how to set this number of batches??, if the number of m3 should be rounded. For the time being, I set the m3 as a numeric variable linked to an MI. Thank you so much. Link to comment Share on other sites More sharing options...
MVP 2014 Simon Posted April 10, 2013 MVP 2014 Report Share Posted April 10, 2013 My quick answer is as follows: 1. Perform integer divide, m3 DIV 100, store the result 2. Perform modulus divide, m3 MOD 100 and perform the following comparison 3. IF m3 MOD 100 = zero, THEN number of batches = m3 DIV 100 OTHERWISE number of batches = (m3 DIV 100) + 1 I hope this makes sense, and anyone is of course welcome to suggest an alternative. Link to comment Share on other sites More sharing options...
JEFG Posted April 29, 2013 Author Report Share Posted April 29, 2013 My quick answer is as follows: 1. Perform integer divide, m3 DIV 100, store the result 2. Perform modulus divide, m3 MOD 100 and perform the following comparison 3. IF m3 MOD 100 = zero, THEN number of batches = m3 DIV 100 OTHERWISE number of batches = (m3 DIV 100) + 1 I hope this makes sense, and anyone is of course welcome to suggest an alternative. Thank you so much. Im trying to get this in next way: In a HMI display I put 2 MI values wich are filled by the operator. The first one, for the integer quanity and in the second MI the operator will write de floating quanity of these m3. Then in ladder if the second MI is greater than zero, the total of batches will increase in 1 unit. Am I ok? Thank you so much Simon. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now