[Logix5000] Dividing by zero

I guess it depends on what you call a good solution.
I think we're speaking about 2 different things here:

1. Multiplying by the inverse of a number: I applied this "trick" when memory was measured in bytes and I needed to save memory. However, that trick requires that you know the numbers (constants) beforehand:

Code:
flow (gpm) = flow (mgd) * .00069444
You can write this equation because you know that .00069444 = 1/1440.

2. OP wrote:

I divide a bunch of variables by total plant flow to work out pump speed.
So the equation is some_variables/flow. If flow is zero, you get a math error. I suppose that some_variables * (1/flow) will give an error when flow is zero.

Said that, I agree with others members that it's necessary to place a compare block before the calculation. I prefer GRT block (never use EQU or NEQ with real numbers, and I suppose that flow is a real).

Also, in the equation some_variables/flow, if some_variables is too high and flow is too low, the equation could throw an overflow error. That's something to take in account.
 
Thanks for all the input guys, really appreciate it. I'm gonna try the bypass of the compute instruction if the flow is equal to 0 and set the value. Shouldn't be too hard, thanks for pointing me in the right direction.
 

Similar Topics

Hi! So my problem is a little funky, I had Studio 5000 v 24 and 30 installed, but forgot to install RSLogix (which I cannot go without). Is there...
Replies
2
Views
159
So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
456
I'm a Siemens person, and this is one of my first AB programs. The customer wants everything programmed in Ladder. I have a lot of data (3...
Replies
14
Views
254
Good day everyone. if you have a logic for 3 pumps (lead/lag/off), would you please email it to me? I really appreciate it!
Replies
7
Views
231
Maybe this is just not possible, or maybe I am doing something wrong. Background; I have a data array of over 1500 products. For sorting I...
Replies
6
Views
779
Back
Top Bottom