from __future__ import division
#Input data
V=64000#Volume in m**3
Q=8300#Discharge in m**3/hr
p1=1#Pressure in bar
T1=20+273#Temperature in K
p2=100#Pressure in bar
pn=70#Polytropic efficiency in percent
pt=60#Peaking turbine efficiency in percent
g=1.4#Ratio of specific heats
cp=1.005#Specific heat in kJ/kg.K
R=0.287#Gas constant in kJ/kg.K
#Calculations
T2sT1=(p2/p1)**((g-1)/g)#Temperature ratio
T2s=(T1*T2sT1)#Temperature in K
T21=(T2s-T1)/(pn/100)#Difference in Temperatures in K
T2=(T21+T1)-273#Temperature in degree C
v=(R*T1)/(p2*100)#Specific volume in m**3/kg
mf=(Q/(v*3600))#Mass flow rate in kg/s
E=(mf*cp*T21)/1000#Rate of energy storage in MW
t=(V/Q)#Storage time in hour
tE=(E*t)#Total energy storage in MWh
Ed=(tE*(pt/100))#Total energy delivered by the peaking turbine in MWh
#Output
print " (a) the compressed sir temperature is %3.0f degree C \n (b) the storage time is %3.2f hour \n (c) the total energy storage is %3.0f MWh \n (d) the total energy delivered by the peaking turbine is %3.0f MWh"%(T2,t,tE,Ed)
from __future__ import division
from math import log
#Input data
V=175000#Volume in m**3
d=4#Diameter in m
U=1.5#Overall heat transfer coefficient in W/m**2.K
p2=2#Pressure in bar
p1=20#Pressure in bar
Ta=20#Ambient temperature in degree C
cp=4.35#Specific heta of water in kJ/kg.K
e=96#Efficiency in percent
ppe=25#Peaking plant efficiency in percent
#Calculations
#At 20 bar
T1=212.37#Saturation temperature in degree C
hf1=908.5#Enthalpy in kJ/kg
vf1=0.0011766#Specific volume in m**3/kg
#At 2 bar
T2=120.23#Saturation temperature in degree C
hf2=504.8#Enthalpy in kJ/kg
vf2=0.0010605#Specific volume in m**3/kg
ad=(1/2)*((1/vf1)+(1/vf2))#Average density of water in kg/m**3
tc=(d*ad*cp*1000)/(4*U*3600)#Time constant in h
ts=(log(1/(1-((1-((e/100)))/((T1-Ta)/(T1-T2))))))*tc#Storage time in h
m=(V/vf1)#Mass of water needed in kg
E=(m*(hf1-hf2))/(3600*10**3)#Total energy stored in MWh
Ed=(E*(e/100)*(ppe/100))#Energy delivered in MWh
#Output
print " (a) the storage time is %3.3f h \n (b) the total energy stored in the accumulator is %3.1f MWh \n (c) the total energy that can be delivered by the peaking turbine is %3.2f MWh"%(ts,E,Ed)