import math
# Variable declaration
w_a=8.4;# The mass flow rate of air in kg/s
R=3.8;# Rating of an air-cooling evaporator in kW/k
T_a=-15;# Entering air temperature in °C
T_r=-21;# Refrigerant temperature in °C
# Calculation
deltaT=(T_a+273)-(T_r+273);# Rating LMTD in K
E=R*deltaT;# Rated duty in kW
C_pair=1.006;# kJ/kg.K
T_ar=E/(C_pair*w_a);# Reduction in air temperature in °C
T_al=T_a-T_ar;# Air leaving temperature in °C
deltaT_min=(T_al+273)-(T_r+273);# K
deltaT_max=deltaT;# K
LMTD=(deltaT_max-deltaT_min)/(math.log(deltaT_max/deltaT_min));
print"\nLMTD=%1.1f K"%LMTD
# Variable declaration
Q=45;# The sensible heat extracted by an air-cooling coil in kW
T_in=24;# The entering air temperature in °C
T_out=18;# The leaving air temperature in °C
T_e=11;# Refrigerant evaporating temperature in °C
C_pa=1.02;# The specific heat capacity of air in kJ/kg.K
Af=[100,95,90,85];# Air flow (%)
m=[7.35,6.99,6.62,6.25];# Mass air flow (kg/s)
T_a=[24,24,24,24];# Air temperature on coil (°C)
deltaT=[6,6.3,6.7,7.1];# ΔT for 45 kW (K)
T_aoff=[18,17.7,17.3,16.9];# Air temperature off coil (°C)
LMTD=[9.7,9.5,9.2,9.0];# LMTD,refrigerant at 11°C (K)
h=[1,0.96,0.92,0.88];# h, in terms of design (from V0.8)
# Calculation
m_af=Q/(C_pa*(T_in-T_out));
Capacity=[(45*h[0]*LMTD[0])/9.7,(45*h[1]*LMTD[1])/9.7,(45*h[2]*LMTD[2])/9.7,(45*h[3]*LMTD[3])/9.7];# kW
print"\nDesign mass air flow=%1.2f kg/s"%m_af
print"The cooling capacity at 100,95,90and 85 percentage mass air flow=%2.0f,%2.1f,%2.1fand %2.1f kW"%(Capacity[0],Capacity[1],Capacity[2],Capacity[3])
# Variable declaration
P_c=10;# kW
T_e=-35;# Evaporating temperature in °C
T_c=40;# Condensing temperature in °C
T_s=5;# Subcooling temperature in K
T_cin=20;# Compressor inlet temperature in °C
T_cout=0;# Zero subcooling temperature in °C
# Calculation
#(a)
v_s1=146.46;# m**3/kg
v_s2=135.25;# m**3/kg
v_sr=v_s1/v_s2;# The ratio of specific volume
# Assuming the compressor pumps the same volume flowrate:
m_1bym_2=v_sr;# Flow rate ratio
print"\nFlow rate ratio,m_2/m_1=%1.3f"%m_1bym_2
#(b)
h_1=392.51;# Suction gas enthalpy at 20°C in kJ/kg
h_2=375.19;# Suction gas enthalpy at 0°C in kJ/kg
h_f=257.77;# Liquid enthalpy at the expansion valve inlet at 40°C in kJ/kg
dh_1=h_1-h_f;# Evaporator enthalpy difference at rating condition in kJ/kg
dh_2=h_2-h_f;# Evaporator enthalpy difference with 0°C suction in kJ/kg
dh_r=dh_2/dh_1;# Enthalpy difference ratio
C_c=P_c*m_1bym_2*dh_r;# Compressor capacity corrected for suction temperature change in kW
print"\nCompressor capacity corrected for suction temperature change=%1.2f kW"%C_c
#(c)
h_f=249.67;# Liquid enthalpy at the expansion valve inlet at 35°C in kJ/kg
dh=h_2-h_f;# Evaporator enthalpy difference at application condition in kJ/kg
dh_r=dh/dh_1;# Enthalpy difference ratio
C_cact=P_c*m_1bym_2*dh_r;# Actual compressor capacity in kW
print"\nActual compressor capacity=%2.2f kW"%C_cact
#(d)
h_g=350.13;# Suction gas enthalpy at evaporator outlet, -30°C (5 K superheat) in kJ/kg
dh_e=h_g-h_f;# Useful evaporator enthalpy difference in kJ/kg
dh_r=dh_e/dh_1;# Enthalpy difference ratio
C_eact=P_c*m_1bym_2*dh_r;# Actual evaporator capacity in kW
print"\nActual evaporator capacity=%1.2f kW"%C_eact
# Variable declaration
T_c1=30;# Condensing temperature for larger condenser in °C
T_c2=35;# Condensing temperature for smaller condenser in °C
Rc_1=242;# Rated capacity of plant for larger condenser in kW
Rc_2=218;# Rated capacity of plant for smaller condenser in kW
Rt_1=1802;# Running time (kW-h)
Rt_2=2000;# Running time (kW-h)
Ci_1=60;# Compressor electrical input power in kW
Ci_2=70;# Compressor electrical input power in kW
Ec_1=11533;# Electricity cost per year (£)
Ec_2=14933;# Electricity cost per year (£)
C_1=14000;# Cost of the larger condenser in £
C_2=8500;# Cost of the smaller condenser in £
# Calculation
Es=Ec_2-Ec_1;# Cost of the larger condenser in £
Bet=(C_1-C_2)*Es**-1;# Break-even time in years
print"Break-even time=%1.1f years"%Bet