clc T0 = 300 // Atmospheric temperature in K Tg1_ = 300 // Higher temperature of combustion product in degree Celcius Tg2_ = 200 // Lower temperature of combustion product in degree Celcius Ta1 = 40 // Initial air temperature in K cpg = 1.09 // Specific heat capacity of combustion gas in kJ/kgK cpa = 1.005// Specific heat capacity of air in kJ/kgK mg = 12.5 // mass flow rate of product in kg/s ma = 11.15// mass flow rate of air in kg/s printf("\n Example 8.8") Tg1 = Tg1_+273 // Higher temperature of combustion product in K Tg2 = Tg2_+273 // Lower temperature of combustion product in K f1 = cpg*(Tg1-T0)-T0*cpg*(log(Tg1/T0)) // Initial availability of product f2 = cpg*(Tg2-T0)-T0*cpg*(log(Tg2/T0)) // Final availability of product printf("\n The initial and final availability of the products are %f kJ/Kg and %f kJ/Kg respectively",f1,f2) //The answer provided in the textbook is wrong // Part (b) Dfg = f1-f2 // Decrease in availability of products Ta2 = (Ta1+273) + (mg/ma)*(cpg/cpa)*(Tg1-Tg2) // Exit temperature of air Ifa = cpa*(Ta2-(Ta1+273))-T0*cpa*(log(Ta2/(Ta1+273))) // Increase in availability of air I = mg*Dfg-ma*Ifa // Irreversibility printf("\n The irreversibility of the process is %f kW",I) ////The answer provided in the textbook contains round off error // Part (c) Ta2_ = (Ta1+273)*(Tg1/Tg2)^((12.5*1.09)/(11.5*1.005)) Q1 = mg*cpg*(Tg1-Tg2) // Heat supply rate from gas to working fluid Q2 = ma*cpa*(Ta2_-(Ta1+273))// Heat rejection rate from the working fluid in heat engine W = Q1-Q2 // Power developed by heat engine printf("\n Total power generated by the heat engine is %f kW",W) //The answer provided in the textbook contains round off error