In [12]:

```
#example 1
#rate of fuel consumption
W=136*0.7355 #output of automobile engine in kW
neng=0.3 #thermal efficiency of automobile engine
Qh=W/neng #energy output of fuel in kW
Q1=Qh-W #total rate of energy rejected to the ambient
qh=35000.0 #energy output of fuel in kJ/kg
m=Qh/qh #rate of fuel consumption in kg/s
print"\n hence,total rate of energy rejected is",round(Q1),"kW"
print"\n and rate of fuel consumption is",round(m,4),"kg/s"
```

In [22]:

```
#example 2
#coefficient of performance of refrigerator
Qh=400 #heat rejected to kitchen air in W
W=150.0 #electrical input power in W
Q1=Qh-W #rate of energy taken out to cold space in W
B=Ql/W #coefficicent of performnace of refrigerator
print"\n hence,rate of energy taken out of the cold space is",round(Q1),"W"
print"\n and coefficient of performance of the refrigerator is",round(B,2),
```

In [6]:

```
#example 3
# temperature at which the pressure go to zero
P1=110.9#pressur at the ice point in kPa
P2=151.5#pressure at the steam point in kPa
T1=0#in C
T2=100#in C
S=(P2-P1)/(T2-T1)#slope in kPa/C
T=T1-(P1/S)# absolute ideal gas temperature in C
print"\n hence,the absolute ideal gas temperature is",round(T,2),"C"
```

In [53]:

```
#example 4
#comparison of ideal carnot heat engine with actual heat engine
Qh=1000.0 #rate of heat transfer to heat engine in kW
W=450.0 #rate of production of work in kW
Ql=Qh-W #rate of heat rejected by heat engine in kW
nthermal=W/Qh #efficiency from the definition of efficiency
Tl=300 #temperature of surroundings in K
Th=550.0 #temperature of heat source in Celsius
ncarnot=1-Tl/(Th+273.15) #efficiency if heat engine is considered to be ideal carnot heat engine
W2=ncarnot*Qh #rate of work production if heat engine is assumed to be ideal carnot heat engine in kW
Q12=Qh-W2 #rate of heat rejected by heat engine in kW if heat engine is assumed to be ideal carnot heat engine
print"\n hence,energy discarded to the ambient surroundings iS",round(Q12,4),"kw"
print"\n and the engine efficiency is",round(ncarnot,4),
```

In [40]:

```
#example 5
#calculating required work
Tl=24+273.15 #room temperature in Kelvins
Th=35+273.15 #atmospheric temperature in Kelvins
Ql=4 #rate of heat rejection from room
B=Tl/(Th-Tl) #coefficient of performance of air conditioner
W=Ql/B #required work in kW
print"\n hence,the magnitude of reqiured work is",round(W,2),"kw"
```