Hello All,
I am trying to develop some code to use some correlation functions to determine pressure drop in piping systems. For example the first two functions are:
dP1 = 0.066x^2 - 0.040x + 0.300 [this is valid for a flow rate of 10 - 30 cfm in a 1/2 inch pipe]
dP2 = 0.010x2 - 0.032x + 0.386 [this is valid for a flow rate of 10 - 90 cfm in a 3/4 inch pipe]
.
.
.
etc.
where:
x - flow rate in cfm
The inputs for thie code will be x [flow rate], L [pipe length] and e [pressure drop tolerance]
this is some idea of what I would like the code to do:
If x < 30
dp = (0.066x^2 - 0.040x + 0.300) * (L/1000) 'Calculate the pressure drop
If dp > e 'check the tolerance. ***(This is where I am stuck) If dp is larger than the tolerance than use the next elseif statement (elseif x < 90). I am not sure if this is the right way to go about it... Any insite would be much appreciated! but if dp is smaller than the tolerance then output the pressure drop.
elseif x < 90
dp = (0.010x2 - 0.032x + 0.386) * (L/1000)
If dp > e 'check the tolerance.
elseif x < 150
.
.
.
The code would continue with more elseif statements. Any thoughts or suggestions would be appreciated.
Thanks
MT
I am trying to develop some code to use some correlation functions to determine pressure drop in piping systems. For example the first two functions are:
dP1 = 0.066x^2 - 0.040x + 0.300 [this is valid for a flow rate of 10 - 30 cfm in a 1/2 inch pipe]
dP2 = 0.010x2 - 0.032x + 0.386 [this is valid for a flow rate of 10 - 90 cfm in a 3/4 inch pipe]
.
.
.
etc.
where:
x - flow rate in cfm
The inputs for thie code will be x [flow rate], L [pipe length] and e [pressure drop tolerance]
this is some idea of what I would like the code to do:
If x < 30
dp = (0.066x^2 - 0.040x + 0.300) * (L/1000) 'Calculate the pressure drop
If dp > e 'check the tolerance. ***(This is where I am stuck) If dp is larger than the tolerance than use the next elseif statement (elseif x < 90). I am not sure if this is the right way to go about it... Any insite would be much appreciated! but if dp is smaller than the tolerance then output the pressure drop.
elseif x < 90
dp = (0.010x2 - 0.032x + 0.386) * (L/1000)
If dp > e 'check the tolerance.
elseif x < 150
.
.
.
The code would continue with more elseif statements. Any thoughts or suggestions would be appreciated.
Thanks
MT