##Part A Chapter 5 Example 2 pg 154
##find the heat be supplied
T1=400.+273.;##K
T2=15.+273.;##K
Q12=200.;##kJ(Q1-Q2=200)
Q1BYQ2=T1/T2;
Q2=Q12/(Q1BYQ2-1.);##kJ
Q1=Q1BYQ2*Q2;##kJ
print"%s %.2f %s"%("Heat to be supplied = ",Q1," kJ");
##Part A Chapter 5 Example 3 pg no 154
import math
T1=42.+273.;##K
T2=4.+273.;##K
Q2=2.;##kJ/s
Q1=T1/T2*Q2;##kJ/s
Pin=Q1-Q2;##kJ/s
print"%s %.2f %s"%("Power required = ",Pin," kJ/s");
##Part A Chapter 5 Example 4 pg no 155
##find the heat and total heat
T1=827.+273.;##K
T2=27.+273.;##K
T3=-13.+273.;##K
Q1=2000.;##kJ
Q2=545.45;##kJ
WE=Q1-Q2;##kJ
Q3BYQ4=T3/T2;
WE_sub_WR=300.;##kJ
WR=WE-WE_sub_WR;##kJ
Q43=WR;##kJ(Q4-Q3=WR)
Q4=WR/(1.-Q3BYQ4);##kJ
Q3=Q4-Q43;##kJ
Qt=Q2+Q4;##kJ
print"%s %.2f %s"%("Heat transfered to refrigerant = ",Q3," kJ");
print"%s %.2f %s"%("Total heat transfered to low temperaturereservoir = ",Qt," kJ");
##Answer is not accurate in the book.
##Part A Chapter 5 Example 5 pg 157
##find the minimum power required
T1=25.+273.;##K
T2=-1.+273.;##K
Q2=125.;##MJ/h
Q1BYQ2=T1/T2;
COP_HP=1./(Q1BYQ2-1.);
W=Q2/COP_HP;##MJ/h
W=W*10**3/3600.;##kW
print"%s %.2f %s"%("Minimum power required = ",W," kW");
##Part A Chapter 5 Example 6 pg no 157
##find the power required
T1=35.+273.;##K
T2=-15.+273.;##K
Q2=140.8;##kW
Q1BYQ2=T1/T2;
Carnot_COP=1./(Q1BYQ2-1.);
Actual_COP=Carnot_COP/4.;
W=Q2/Actual_COP;##kW
print"%s %.2f %s"%("Power required = ",W," kW");
##Answer is not accurate in the book.