import math
#Variable initialization
t=4.0 #hr time
Ihp=8.0 #ihp power
Ohp=5.0 #hp power
#CALCULATIONS
Hl=t*2544.0*(Ihp-Ohp)
#RESULT
print(' Total Btu heat loss over a period of 4 hr = %.3f Btu ' %Hl)
import math
#Variable initialization
t=1.0 #sec time
P=1000.0 #lbf/in^2 pressure
Q=3.0 #gpm flow rate
Sg=0.85 # density
s=0.42
#CALCULATIONS
H=42.4*((P*Q)/1714) #Heat Generation Rate
m=8.34*Q*Sg #mass flow Rate
Tr=H/(m*s)
#RESULTS
print(' Rise in temperature of the fluid = %.2f F' %Tr)
import math
#Variable initialization
P=1500.0 #lbf/in^2 pressure
d=12.0 #in diameter
V=50.0 #gal volume
#CALCULATIONS
F=P*(math.pi*d**2/4)
S=V*231.0*4.0/(math.pi*d**2)
#RESULTS
print('Weight = %.3f lbf ' %F)
print('\n Stroke length = %.3f in ' %S)
import math
#Variable initialization
P=1500.0 #lbf/in^2 pressure
V=5.0 #gal volume
P1=3000.0 #lbf/in^2 pressure
P2=2000.0 #lbf/in^2 pressure
#CALCULATIONS
V2=V*231.0*(P2+14.7)/(P1-P2)
V1=V2*(P1+14.7)/((P+14.7)*231.0)
#RESULT
print('\n Size of accumulator = %.3f gal ' %V1)
import math
#Variable initialization
beta=1.4
p3=2000.0+14.7 #non guage presure
p2=3000.0+14.7 #non guage presure
p1=1500.0+14.7 #non guage presure
deltav=1155.0
#Calculations
v2=(p3/p2)**(1/beta)*(deltav)/(1-(p3/p2)**(1/beta))
v1=v2*(p2/p1)**(1/beta)
perdiff=(v1-4627.25)*100.0/v1
#Results
print(' Volume 2 = %.3f in^3' %v2)
print(' \n Volume 1 = %.3f in^3' %v1)
print(' \n Percentage difference in volume = %.3f percent' %perdiff )
import math
#Variable initialization
Fr=20.0 #gpm flowrate
P=2500.0 #lbf/in^2 pressure
sf=4.0 #safety factor
Ts=55000.0 #lbf/in^2 pressure
V=15.0 #ft/s velocity
#CALCULATIONS
A=Fr*0.3208/V
ID=2.0*math.sqrt(A/math.pi)
Wt=P*ID/(2*(Ts-P))
Wt1=Wt*sf
#RESULT
print('Wall thcikness = %.3f in ' %Wt1)