Under More Pressure - The Friday Night Quiz

d Pressure/dt=BulkModulusOfOil*Kv*sqrt(SupplyPressure-Pressure)/Volume

Rearranging:
dt=(Volume/BulkModulusOfOil*Kv) d Pressure(SupplyPressure-Pressure)^(-1/2)
Integrating:
t=(Volume/BulkModulusOfOil*Kv)(-2)sqrt(SupplyPressure-Pressure)+C
Plugging in
t=(Volume/200,000*Kv)(-2)sqrt(2000-Pressure)+C

BulkModulusOfOil=200,000
(Volume/BulkModulusOfOil*Kv) = constant, I think

SupplyPressure=2000psi
at t=0, Pressure=1000
at t=x, Pressure=2000psi
(missing an important step here)

So, my best guess is:
t=4,000,000sqrt(10)*Kv*Volume
 
I blew it, I am posting this to all three forums

I can see that I have "blown it". I didn't provide all the required data.

The valve constant is 4.6
The supply pressure is 2000 psi
The volume of oil that is being compressed is fixed. It is 41.42 cubic inches

Solving this problem can be done in a couple of ways.
1. Iteratively using a spread sheet or a CAS ( computer algebra system) such as Mathcad, Scilab etc.

2. Use algebra and calculus. The first part would require calculating how many cubic inches of oil it takes to raise the pressure from 1000 psi to 2000 psi given the fixed volume of 31.42 cubic inches. That part should be easy. The second part is calculating the time it takes for the required oil to flow into the volume. That is the hard part in that is it requires calculus. I had to look up the form of the integration as http://www.sosmath.com.

3. One can make an estimate of time it takes the pressure to go from 1000 psi to 2000 psi by assuming an average rate of change. When thinking in the field this is the method I use most often.

I tried to post the same thing to all three forums but I was frustrated because not all forums would accept Greek characters. I was also frustrated because my OpenOffice spreadsheet solution was extremely slow for reasons unknown.
 
Oops, flipped the 200,000 above - hate doing math in notepad. :-( Unless there is unit conversion in the constants, that would make my answer:
t=(Volume/200,000*Kv)(-2)sqrt(2000-Pressure)
=.002159973s
 
Good, that is the simple quick answer assuming the avg rate is 1/2 the initial rat

Oops, flipped the 200,000 above - hate doing math in notepad.
What? You didn't use python? You will need it for the next part.

Your answer is good enough for most practical discussions and calculations but I think we can do better.

The initial pressure rate is 928937.71 psi/sec but the rate is continuously changing. The next instance the pressure changes so the flow changes. Therefore a more accurate estimate of the time can be obtained if the calculations are done in small increments. What if the pressure was calculated in 100 or even 10 microsecond increments? Then the formula is:

Pressure = Pressure + PressureRate(Pressure)*T
where T is the update period which should be about 10-100 microseconds.

This needs to be done using a program. A python program will do nicely. This can also be calculated using a spread sheet. Try it using different values of T.

There is one gotcha for those that take the challenge. The pressure will increase slower and slower as it approaches the supply pressure. When the pressure gets to the supply pressure the pressure may go slightly above the supply pressure. When this happens the sqrt function will generate and erros so you must also check the sign of SupplyPressure-Pressure
 
Lol - it was a math problem. I did math. Your really long variable names were driving me crazy, I but figured consistency would help. Good enough confuses me though - either I did it correctly or did not. Calculus should give the exact answer, more so than approximating with iterations of a small delta - it seems like our equation does take the effects of the change in flow due to the change in pressure into account. Remember, we plugged Flow into the above equation. SupplyPressure is constant and Pressure is continuously changing - our equation took this into account.

Flow=Kv*sqrt(SupplyPressure-Pressure)
 
OK, Python it was.

My calculus answer was this:
t=(Volume/200,000*Kv)(-2)sqrt(2000-Pressure)=.002159973s

p: 2002.0881256918535 t: 0.0020000000000000005 dt: 1.0E-4 i: 20
p: 2000.0152524143948 t: 0.0021300000000000047 dt: 1.0E-5 i: 213
p: 2000.0001982553645 t: 0.0021559999999999618 dt: 1.0E-6 i: 2156
p: 2000.0000016345523 t: 0.002159499999999981 dt: 1.0E-7 i: 21595
p: 2000.0000004993938 t: 0.002159699999999156 dt: 5.0E-8 i: 43194
p: 2000.000000019071 t: 0.0021599099999951524 dt: 1.0E-8 i: 215991
p: 2000.000000004937 t: 0.0021599399999911624 dt: 5.0E-9 i: 431988
p: 2000.000000000201 t: 0.002159965999900659 dt: 1.0E-9 i: 2159966

The simulation results clearly converge on the correct answer.

Code:
import math
p=1000
p0=2000
t=0
dt=.000000001
v=31.42
kv=4.6
bm=200000
i=0

while p<p0:
	i=i+1
	dp=bm*kv*math.sqrt(abs(p0-p))/v
	if (p>p0):
		dp=-dp
	p=p+dp*dt
	t=t+dt
	
print "p: ", p, "  t:", t, "dt: ", dt, "i: ", i
 
Last edited:
surferb said:
Good enough confuses me though - either I did it correctly or did not.
Yes, if you assume the average rate of change in pressure is 1/2 the initial rate of change.

Calculus should give the exact answer, more so than approximating with iterations of a small delta - it seems like our equation does take the effects of the change in flow due to the change in pressure into account.
Calculus will provide the exact answer but honestly I don't remember the integratation formula. This isn't a simple polynomial because there is a square root function. I doubt any body else does either and there are many here that don't know calculus part of the goal is to show how one figures out problems like this with calculus. All one needs is a spread sheet, Scilab, Mathlab, python etc and the willingness to compute the changes in pressure in small time increments. It doesn't take much effort.

Some hydraulic points.
1. The volume of compressed makes a big differnce in the rate the oil compresses.
2. You can see the pressure changes very rapidly. One needs very fast control loops to control pressure. The formula above does not take into account the usually we have the valve open only 1 to 2% at most. This reduces the pressure rate and makes it controllable.
 
We didn't ever make that assumption. dP/dt changes continuously.
dP/dt=BM/V*(dV/t)

Peter Nachtwey said:
Yes, if you assume the average rate of change in pressure is 1/2 the initial rate of change.

Oh please - you can't post differential equations as the Friday Math problem then claim that nobody here can do basic calculus. The math was the easiest part - it took 2 steps (rearranging, integrating) then plugging in numbers. Most terms were constants with respect to our integration variables. The only tricky part, integrating (C-x)^(-1/2)dx, is about as simple an integral as you can do - sqrt is 1/2 power - same rules apply. I forgot and asked google, then a web site. Whole thing took less than 5 minutes.

http://integrals.wolfram.com/index.jsp?expr=(c-x)^(-1/2)&random=false

Peter Nachtwey said:
Calculus will provide the exact answer but honestly I don't remember the integratation formula. This isn't a simple polynomial because there is a square root function. I doubt any body else does either and there are many here that don't know calculus part of the goal is to show how one figures out problems like this with calculus. All one needs is a spread sheet, Scilab, Mathlab, python etc and the willingness to compute the changes in pressure in small time increments. It doesn't take much effort.

Thanks for the hydraulics lesson - I haven't studied anything but the very basics.
Peter Nachtwey said:
Some hydraulic points.
1. The volume of compressed makes a big differnce in the rate the oil compresses.
2. You can see the pressure changes very rapidly. One needs very fast control loops to control pressure. The formula above does not take into account the usually we have the valve open only 1 to 2% at most. This reduces the pressure rate and makes it controllable.
 
Last edited:
Excellent

You must have made post #11 while I was making post #12. Good job
I noticed that your time increment is very small. Nanoseconds? LOL. I didn't understand the

p: 2002.0881256918535 t: 0.0020000000000000005 dt: 1.0E-4 i: 20
p: 2000.0152524143948 t: 0.0021300000000000047 dt: 1.0E-5 i: 213
p: 2000.0001982553645 t: 0.0021559999999999618 dt: 1.0E-6 i: 2156
p: 2000.0000016345523 t: 0.002159499999999981 dt: 1.0E-7 i: 21595
p: 2000.0000004993938 t: 0.002159699999999156 dt: 5.0E-8 i: 43194
p: 2000.000000019071 t: 0.0021599099999951524 dt: 1.0E-8 i: 215991
p: 2000.000000004937 t: 0.0021599399999911624 dt: 5.0E-9 i: 431988
p: 2000.000000000201 t: 0.002159965999900659 dt: 1.0E-9 i: 2159966
The pressures go above 2000. That shouldn't happen if the starting pressure is below the supply pressure. Did your solution oscillate around 2000 because the time period was too big?


surferb Oh please - you can't post differential equations as the Friday Math problem then claim that nobody here can do basic calculus. [/quote said:
I didn't say nobody can do it. I said I doubt anybody remembers the formula. The square root is in the numerator, not the denominator.

The math was the easiest part - it took 2 steps (rearranging, integrating) then plugging in numbers. Most terms were constants with respect to our integration variables. The only tricky part, integrating (C-x)^(-1/2)dx, is about as simple an integral as you can do - sqrt is 1/2 power - same rules apply. I forgot and asked google, then a web site. Whole thing took less than 5 minutes.

http://integrals.wolfram.com/index.jsp?expr=(c-x)^(-1/2)&random=false
The numerical solution is correct. The symbolic calculus solution is not. You have the sign wrong on the exponent. It is easy to find a solution using a spread sheet or numerically. It just takes a little algebra. Below is my solution using a spread sheet. I used open office but saved the spreadsheet in excel format.
ftp://ftp.deltacompsys.com/public/N...tacompsys.com/public/NG/UnderMorePressure.zip
Notice what happens when the time period is 100 microseconds. The solution oscillates. I could make the time period smaller but I would need 10 times more rows and the spread sheet would be very small. There are better ways to compute the slope or rate of change.

Thanks for the hydraulics lesson - I haven't studied anything but the very basics.
Δp=-B*ΔV/V is the basic formula for how pressure changes. The key is the ΔV can come from flow or motion of the piston.
 
Your iterative approach oscillated around 2000 - smaller values of dt obviously came closer.

Peter Nachtwey said:
I didn't understand the the pressures go above 2000. That shouldn't happen if the starting pressure is below the supply pressure. Did your solution oscillate around 2000 because the time period was too big?

The radical is in the denominator because of the algebra to get the separation of variables on the correct side. Dropping the constants, dP/dt=sqrt(P) -> dP/sqrt(P)=dt. I find it very difficult to believe that the symbolic calculus is incorrect and the numerical solution is correct. The limit of the approximation converges on the same solution as dt approaches zero. In other words, my calculated solution provided a much better answer.

You will find that the pressure will never exceed the supply pressure using the correct approach - the error is introduced in the iterative approximation. Writing a script is more accurate than a spreadsheet because it can handle more iterations. Excel can handle a maximum of 64k rows, whereas my last script ran 2 million iterations. There are better methods of iterative approximation, but solving the problem with Calculus is exact.

Fun stuff, though - thanks for the problem.
Peter Nachtwey said:
The square root is in the numerator, not the denominator.


The numerical solution is correct. The symbolic calculus solution is not. You have the sign wrong on the exponent. It is easy to find a solution using a spread sheet or numerically. It just takes a little algebra. Below is my solution using a spread sheet. I used open office but saved the spreadsheet in excel format.
ftp://ftp.deltacompsys.com/public/N...tacompsys.com/public/NG/UnderMorePressure.zip
Notice what happens when the time period is 100 microseconds. The solution oscillates. I could make the time period smaller but I would need 10 times more rows and the spread sheet would be very small. There are better ways to compute the slope or rate of change.
 
Last edited:

Similar Topics

As some of you may know I'm currently at our property in Thailand, decided to do a re-wire before taking some R&R in and around the coasts, The...
Replies
5
Views
1,900
I speculate that PLCs translate the language from programmers (e.g Ladder Logic, SFCs, Structured Text) into a common intermediate language...
Replies
15
Views
4,198
We've got a submersible water level sensor in our tank. We drained it, but when there was still a bit of water in the tank (about 20mm measured...
Replies
15
Views
2,771
Morning all. I’m looking for a simple sounder (adjustable volume), perhaps with a single beacon that can operate as a Modbus TCP slave, POE...
Replies
0
Views
1,205
Hi everyone, i would like to know if this setup is possible and make sense. The current architecture is the one in the picture but without the...
Replies
23
Views
5,067
Back
Top Bottom