#Input data
Qab=720 #Heat transfer of 1st processes in KJ
Qbc=-80 #Heat transfer of 2nd processes in KJ
Qcd=40 #Heat transfer of 3rd processes in KJ
Qda=-640 #Heat transfer of 4th processes in KJ
Wab=-90 #Work transfer of 1st processes in KJ
Wbc=-50 #Work transfer of 2nd processes in KJ
Wcd=130 #Work transfer of 3rd processes in KJ
#Calculation
#From the 1st law of thermodynamic for close system undergoing a cycle.
#Work interaction during the 4th processes
Wda=((Qab+Qbc+Qcd+Qda)-(Wab+Wbc+Wcd))
#Output
print("Work interaction during the 4th processes=",Wda,"KJ")
#Input data
#During compression
W1=-9200 #Stroke work done by the piston in Nm
Nm1=-9.2 #Nm of work done
Q1=-50 #Heat rejected during copression in KJ
#During expansion
W2=8400 #Stroke work done by the piston in Nm
Nm2=8.4 #Nm of work done
#Calculation
#Quantity of heat transferred
Q2=-((Nm1+Nm2)+Q1) #-sign for indicate heat is transferred
#Output
print("Quantity of heat transferred=",Q2,"KJ")
#input data
W1=-20 #Work interaction to the fluid in KJ
W2=42 #Work interaction from the fluid in KJ
Q1=85 #Heat interaction to the fluid in KJ
Q2=85 #Heat interaction to the fluid in KJ
Q3=-50 #Heat interaction from the fluid in KJ
#calculation
W3=((Q1+Q2+Q3)-(W1+W2)) #Magnitude and direction of the third heat interation
#output
print("Magnitude and direction of the third heat interation=",W3,"KJ")
#Input data
Q=-2100 #Non flow process losses heat in KJ
deltaU=420 #Gain heat
#Calculation
W=Q-deltaU #Work done and compression process in KJ
#Output
print("Work done and compression process=",W,"KJ")
#Input data
W=-2000 #Work input of panddle wheel in KJ
Q=-6000 #Heat transferred to the surrounding from tank
#Calculation
deltaU=Q-W #Change in interval energy
#Output
print("change in interval energy drop=",deltaU,"KJ")
#Input data
U1=520 #internal energy in KJ/Kg
U2=350 #internal energy in KJ/Kg
W=-80 #work done by the air in the cylinder KJ/kg
#Calculation
deltaU=U2-U1
Q=deltaU+W #Heat transferred during the process
#Output
print("Heat transferred during the process=",Q,"KJ")
#Input data
W1=800 #Power of turbine shaft Kw
W2=-5 #Work pump to feed in Kw
Q1=2700 #Heat for steam generation KJ/Kg
Q2=-1800 #Condenser rejected heat KJ/Kg
#Calculation
m=((W1+W2)/(Q1+Q2)) #Steam flow rate in Kg/h
#Output
print("Steam flow rate=",round(m,4),"Kg/s")
#input data
#Data consistent with first law pf thermodynamics
Qabcd=-22 #In KJ
N=150 #In Cycles/min
Qab=17580 #In KJ/min
Qbc=0
Qcd=-3660 #In KJ/min
Wab=-8160 #In KJ/min
Wbc=4170 #In KJ/min
DeltaUcd=-21630 #In KJ/min
#calculation
DeltaUab=Qab-Wab #In KJ/min
DeltaUbc=Qbc-Wbc #In KJ/min
Wcd=Qcd-DeltaUcd #In KJ/min
Qabcd1=-220*150 #In KJ/min
Qda=((Qabcd1)-(Qab+Qbc+Qcd)) #In KJ/min
Wda=((Qabcd1)-(Wab+Wbc+Wcd)) #In KJ/min
DeltaUabcd=0
DeltaUda=((DeltaUabcd)-(DeltaUab+DeltaUbc+DeltaUcd)) #In KJ/min
NWO=Qabcd1/60 #In KW
#output
print("DeltaUab= ",DeltaUab,"KJ/min")
print("DeltaUbc= ",DeltaUbc,"KJ/min")
print("Wcd= ",Wcd,"KJ/min")
print("Qabcd1= ",Qabcd1,"KJ/min")
print("Qda= ",Qda,"KJ/min")
print("Wda= ",Wda,"KJ/min")
print("DeltaUabcd= ",DeltaUabcd,"KJ/min")
print("DeltaUda= ",DeltaUda,"KJ/min")
print("NWO=",NWO,"Kw")
#Input data
Qab=-6500 #Heat transferred in 1st process KJ/min
Qbc=0 #Heat transferred in 2nd process
Qcd=-10200 #Heat transferred in 3rd process KJ/min
Qda=32600 #Heat transferred in 4th process KJ/min
Wab=-1050 #Heat transferred in 1st process KJ
Wbc=-3450 #Heat transferred in 2nd process KJ
Wcd=20400 #Heat transferred in 3rd process KJ
Wda=0 #Heat transferred in 4th process
#Calculator
dQ=Qab+Qbc+Qcd+Qda #Net heat transfer in 1st cycle
dW=Wab+Wbc+Wcd+Wda #Net work done in 1st cycle
dW1=dW/60 #Net work done in 1st cycle
DeltaUab=Qab-Wab #ab process
DeltaUbc=Qbc-Wbc #bc processes
DeltaUcd=Qcd-Wcd #cd processes
DeltaUda=Qda-Wda #dc processes
#Output
print("Net heat transfer in 1st cycle= ",dQ,"KJ/min")
print("Net work done in 1st cycle= ",dW,"KJ/min")
print("Net work done in 1st cycle= ",dW1,"KW")
print("ab process= ",DeltaUab,"KJ/min")
print("bc processes= ",DeltaUbc,"KJ/min")
print("cd processes= ",DeltaUcd,"KJ/min")
print("dc processes= ",DeltaUda,"KJ/min")