summaryrefslogtreecommitdiff
path: root/Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb
diff options
context:
space:
mode:
authorprashantsinalkar2020-04-14 10:19:27 +0530
committerprashantsinalkar2020-04-14 10:23:54 +0530
commit476705d693c7122d34f9b049fa79b935405c9b49 (patch)
tree2b1df110e24ff0174830d7f825f43ff1c134d1af /Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb
parentabb52650288b08a680335531742a7126ad0fb846 (diff)
downloadall-scilab-tbc-books-ipynb-476705d693c7122d34f9b049fa79b935405c9b49.tar.gz
all-scilab-tbc-books-ipynb-476705d693c7122d34f9b049fa79b935405c9b49.tar.bz2
all-scilab-tbc-books-ipynb-476705d693c7122d34f9b049fa79b935405c9b49.zip
Initial commit
Diffstat (limited to 'Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb')
-rw-r--r--Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb872
1 files changed, 872 insertions, 0 deletions
diff --git a/Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb b/Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb
new file mode 100644
index 0000000..53773d8
--- /dev/null
+++ b/Thermodynamics_by_B_L_Singhal/3-Second_Law_of_Thermodynamics.ipynb
@@ -0,0 +1,872 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 3: Second Law of Thermodynamics"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.10: Time_required_to_freeze_water.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.10\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"m=0.8;//Kg\n",
+"hi=335;//KJ/Kg-water\n",
+"T1=24+273;//K\n",
+"T2=0+273;//K\n",
+"Wdot=400;//W\n",
+"Wdot=Wdot/1000;//KW\n",
+"Q2=m*hi;//KJ\n",
+"ActualCOP=T2/(T1-T2)*30/100;\n",
+"Q2dot=ActualCOP/Wdot;//KJ/s\n",
+"T=Q2/Q2dot;//sec\n",
+"disp(T,'Time required to freeze the water in sec : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.11: Possibilty_of_claim.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.11\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=727+273;//K\n",
+"T2=27+273;//K\n",
+"Wdot=76;//KW\n",
+"FuelBurned=4;//Kg/hr\n",
+"FuelBurned=4/3600;//Kg/sec\n",
+"FuelHeatingValue=75000;//KJ/Kg\n",
+"Q1dot=FuelBurned*FuelHeatingValue;//KJ/s or KW\n",
+"Eta=Wdot/Q1dot*100;//%\n",
+"disp(Eta,'Actual Efficiency of Engine in % : ');\n",
+"Eta_c=(1-T2/T1)*100;//%\n",
+"disp(Eta_c,'Carnot Efficiency of Engine in % : ');\n",
+"disp('Claim of inventor is wrong as actual efficiency is greater than carnot efficiency.');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.12: Power_required_to_run_the_heat_pump.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.12\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',5);\n",
+"\n",
+"//Given Data :\n",
+"T1=24+273;//K\n",
+"T2=10+273;//K\n",
+"Q1=1500;//kJ/min\n",
+"Q1=Q1/60;//kW\n",
+"COP_ideal=T1/(T1-T2);\n",
+"ActualCOP=COP_ideal*30/100;\n",
+"W=Q1/ActualCOP;//kW\n",
+"disp(W,'Power required in kW : ');\n",
+"//Answer is wromg in the book as calculation for Q1 is wrong."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.13: Patent_of_engine.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.13\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',5);\n",
+"\n",
+"//Given Data :\n",
+"T1=450;//K\n",
+"T2=280;//K\n",
+"Q1=1200;//KJ\n",
+"W=0.15;//KWh\n",
+"W=W*3600;//KJ\n",
+"Eta_a=W/Q1*100;//%\n",
+"disp(Eta_a,'Actual Efficiency of Engine in % : ');\n",
+"Eta_c=(1-T2/T1)*100;//%\n",
+"disp(Eta_c,'Carnot Efficiency of Engine in % : ');\n",
+"disp('We would not issue a patent as actual efficiency is greater than carnot efficiency.');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.14: Heat_rejected_Work_done_and_Efficiency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.14\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=1000;//K\n",
+"T3=100;//K\n",
+"Q1=1680;//KJ\n",
+"//Eta_a=Eta_b : 1-T2/T1=1-T3/T2\n",
+"T2=sqrt(T1*T3);//K\n",
+"Eta_a=1-T2/T1;\n",
+"Eta_b=Eta_a;\n",
+"W1=Eta_a*Q1;//KJ\n",
+"Q2=Q1-W1;//KJ\n",
+"Q3=(1-Eta_b)*Q2;//KJ\n",
+"disp(Q3,'Heat rejected by engine B in KJ : ');\n",
+"disp(T2,'Temperature at which heat is rejected by engine A in K : ');\n",
+"disp(W1,'Workdone by engine A in KJ ; ');\n",
+"W2=Eta_b*Q2;//KJ\n",
+"disp(W2,'Workdone by engine B in KJ ; ');\n",
+"//If W1=W2\n",
+"//Q/T=constant\n",
+"T2=(T1+T3)/2;//K\n",
+"Eta_a=(1-T2/T1)*100;//%\n",
+"Eta_b=(1-T3/T2)*100;//%\n",
+"disp('If Engine A & B deliver equal work.')\n",
+"disp(Eta_a,'Efficiency of Engine A in % : ');\n",
+"disp(Eta_b,'Efficiency of Engine B in % : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.15: Heat_absorbed_by_the_refrigerant.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.15\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"T1=800+273;//K\n",
+"T2=30+273;//K\n",
+"T3=30+273;//K\n",
+"T4=-15+273;//K\n",
+"Q1=1900;//KJ\n",
+"W2=290;//KJ\n",
+"//Eta=1-T2/T1=W1/Q1\n",
+"W1=(1-T2/T1)*Q1;//KJ\n",
+"Q2=Q1-W1;//KJ\n",
+"W3=W1-W2;//KJ\n",
+"//COP=T4/(T3-T4)=Q4/W3\n",
+"Q4=T4/(T3-T4)*W3;//KJ\n",
+"disp(Q4,'Heat absorbed by refrigerant in KJ : ');\n",
+"Q3=W3+Q4;//KJ\n",
+"TotalHeat=Q2+Q3;//KJ\n",
+"disp(TotalHeat,'Total Heat transferred to reservoir at 30 degree centigrade in KJ : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.16: Rate_of_heat_supply_and_heat_rejection.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.16\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"T1=840+273;//K\n",
+"T2=60+273;//K\n",
+"T3=5+273;//K\n",
+"W3=30;//KW\n",
+"Q3=17;//KJ/s\n",
+"//Q3/T3=Q4/T4\n",
+"T4=T2;//K\n",
+"Q4=Q3/T3*T4;//KJ/s\n",
+"W2=Q4-Q3;//KJ/s\n",
+"W1=W2+W3;//KJ/s\n",
+"Q1subQ2=W1;//KJ/s\n",
+"//Q1/T1=Q2/T2\n",
+"Q1ByQ2=T1/T2;\n",
+"//Q1subQ2=Q1subQ2*Q2-Q2\n",
+"Q2=Q1subQ2/(Q1ByQ2-1);//KW\n",
+"Q1=Q1ByQ2*Q2;//KW\n",
+"disp(Q1,'Rate of heat supply from 800 degree C source in KW : ');\n",
+"disp(Q2+Q4,'Rate of heat rejection to sink in KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.17: Inventors_Claim.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.17\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"T1=27+273;//K\n",
+"T2=-23+273;//K\n",
+"W=1;//KW\n",
+"Q2=20000;//KJ/hr\n",
+"Q2=Q2/3600;//KJ/s\n",
+"ActualCOP=Q2/W;\n",
+"disp(ActualCOP,'Actual COP of machine : ');\n",
+"IdealCOP=T2/(T1-T2);\n",
+"disp(IdealCOP,'Ideal COP of machine : ');\n",
+"disp('ActualCOP>IdealCOP, Inventor claim is wrong.');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.18: Max_Power_and_Max_Temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.18\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',8);\n",
+"\n",
+"//Given Data :\n",
+"//Heat Pump in winter\n",
+"Q1=2400;//KJ/hr/degree temperature difference\n",
+"t1=20;//degreeC\n",
+"t2=0;//degreeC\n",
+"Q1=Q1*(t1-t2)/3600;//KJ/s\n",
+"T1=t1+273;//K\n",
+"T2=t2+273;//K\n",
+"COP=T1/(T1-T2);\n",
+"W=Q1/COP;//KW\n",
+"disp(W,'Power required to drive heat pump in KW : ');\n",
+"//Refrigerating unit in summer\n",
+"T4=20+273;//K\n",
+"//Q4=2400*(T3-T4)/3600;//KJ/s\n",
+"Q3subQ4=W;//KJ\n",
+"//COP=Q4/(Q3subQ4)=T4/(T3-T4);\n",
+"//T3^2-2*T3*T4+T4^2-T4*3600/2400*(Q3subQ4)=0\n",
+"P=[1 -2*T4 T4^2-T4*3600/2400*(Q3subQ4)]\n",
+"T3=roots(P);\n",
+"T3=T3(1);//K(Maximum outside temperature)\n",
+"disp(T3,'Maximum outside temperature in K : ');\n",
+"disp(T3-273,'or in degree C :');\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.1: Determine_COP.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.1\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"Q2=1800;//KJ/hr\n",
+"Q2=Q2/3600;//KJ/sec or KW\n",
+"W=0.35;//KW\n",
+"COP=Q2/W;\n",
+"disp(COP,'COP is : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.20: Expansion_Ratio.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.20\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',5);\n",
+"\n",
+"//Given Data :\n",
+"VcByVa=14;//Overall expansion ratio\n",
+"T1=257+273;//K\n",
+"T2=27+273;//K\n",
+"Gamma=1.4;\n",
+"Ta=T1;//K\n",
+"Tb=T1;//K\n",
+"Tc=T2;//K\n",
+"Td=T2;//K\n",
+"VcByVb=(Tb/Tc)^(1/(Gamma-1));//Expansion ratio for Adiabatic Process : \n",
+"disp(VcByVb,'Expansion ratio for adiabatic process : ');\n",
+"VbByVa=VcByVa/VcByVb;//Expansion ratio for Isothermal Process : \n",
+"disp(VbByVa,'Expansion ratio for Isothermal process : ');\n",
+"Eta=(1-T2/T1)*100;//%\n",
+"disp(Eta,'Thermal Efficiency of carnot cycle in % : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.21: Minimum_Theoretical_area.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.21\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"W=10;//KW\n",
+"//For flat plate collector\n",
+"T1=90+273;//K\n",
+"T2=27+273;//K\n",
+"Tmax=T1;//K\n",
+"IE=1;//KW/m^2 incident energy\n",
+"EtaCollection=60/100;\n",
+"//Eta=1-T2/T1=W/Q1\n",
+"Q1=W/(1-T2/T1);//KJ/s\n",
+"A1=Q1/IE/EtaCollection;//m^2\n",
+"disp(A1,'Solar Collector Area required in m^2 : ');\n",
+"//For parabolic collector\n",
+"T3=250+273;//K\n",
+"T4=27+273;//K\n",
+"Tmax=T3;//K\n",
+"IE=1;//KW/m^2 incident energy\n",
+"EtaCollection=50/100;\n",
+"//Eta=1-T2/T1=W/Q1\n",
+"Q3=W/(1-T4/T3);//KJ/s\n",
+"A2=Q3/IE/EtaCollection;//m^2\n",
+"disp(A2,'Parabolic Solar Collector Area required in m^2 : ');\n",
+"//Answer of 2nd part is wrong in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.24: COP_and_Work_input.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.24\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=40+273;//K\n",
+"T2=5+273;//K\n",
+"T3=400+273;//K\n",
+"T4=T1;//K\n",
+"Q2=1500;//KJ/min\n",
+"COP_R=T2/(T1-T2);\n",
+"disp(COP_R,'COP of refrigerator is : ');\n",
+"Q2dot=Q2/60;//KJ/s\n",
+"Wdot=Q2dot/COP_R;//KW\n",
+"disp(Wdot,'Work Input to refrigerator in KW : ');\n",
+"Eta=(1-T4/T3);//%\n",
+"Q3dot=Wdot/Eta;//KW\n",
+"OverallCOP=Q2dot/Q3dot;//\n",
+"disp(OverallCOP,'Overall COP of refrigerator : ');\n",
+"//Ans of overall COP is wrong in the book."
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.25: Determine_the_COP.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.25\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=1500;//K\n",
+"T2=450;//K\n",
+"T3=150;//K\n",
+"Q3=250;//KJ\n",
+"COP_CR=T3/(T2-T3);\n",
+"disp(COP_CR,'COP of cold refrigerator is : ');\n",
+"COP_HR=T2/(T1-T2);\n",
+"disp(COP_HR,'COP of hotter refrigerator is : ');\n",
+"COP=T3/(T1-T3);\n",
+"disp(COP,'COP of composite system is : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.26: Heat_Supplied_and_efficiency.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.26\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=870;//K\n",
+"T2=580;//K\n",
+"T3=290;//K\n",
+"Wdot=85;//KW\n",
+"Q3=3000;//KJmin\n",
+"Q3=Q3/60;//KJ/s\n",
+"Q1plusQ2=Wdot+Q3;//KJ\n",
+"//sigma(Q/T)=0\n",
+"//Q1/T1+Q2/T2=Q3/T3\n",
+"//Q1/T1+(Q1plusQ2-Q1)/T2-Q3/T3=0\n",
+"Q1=(-Q3*T1*T2/T3+Q1plusQ2*T1)/(T1-T2);//KW\n",
+"disp(Q1,'Heat Supplied by source1 in KW : ');\n",
+"Q2=Q1plusQ2-Q1;//KW\n",
+"disp(Q2,'Heat Supplied by source2 in KW : ');\n",
+"Eta=Wdot/(Q1+Q2)*100;//%\n",
+"disp(Eta,'Efficiency of engine in % :');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.2: COP_Temperature_and_Heat_Rejected.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.2\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"Q2=1;//KJ/sec or KW\n",
+"W=0.4;//KW\n",
+"T2=-30+273;//K\n",
+"COP=Q2/W;\n",
+"disp(COP,'COP of refrigerator is : ');\n",
+"T1=T2*(1+COP)/COP;//K\n",
+"disp(T1,'Temperature at which heat is rejected in K : ');\n",
+"Q1=Q2*(1+COP)/COP;//KW\n",
+"disp(Q1,'Heat rejected per KW of cooling(KW) : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.3: Power_Input_COP.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.3\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"Q2=100;//KJ/sec or KW\n",
+"T2=-20+273;//K\n",
+"T1=35+273;//K\n",
+"COP=T2/(T1-T2);\n",
+"disp(COP,'COP is : ');\n",
+"W=Q2/COP;//KW\n",
+"disp(W,'Power input in KJ/s or KW : ');\n",
+"COPheatpump=T1/(T1-T2);//\n",
+"disp(COPheatpump,'COP as heat pump : ');\n",
+"Eta_engine=(1-T2/T1)*100;\n",
+"disp(Eta_engine,'Efficiency as an engine in % : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.4: COP_and_Heat_transfer_rate.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.4\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"Q2dot=12000;//KJ/hr\n",
+"Wdot=0.75;//KW\n",
+"Wdot=Wdot*3600;//KJ/hr\n",
+"COP=Q2dot/Wdot;\n",
+"disp(COP,'Coefficient of Performance is : ');\n",
+"Q1dot=Q2dot+Wdot;//KJ/hr\n",
+"disp(Q1dot,'Heat transfer rate in condenser in KJ/hr : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.5: Source_and_sink_temperature.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.5\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"Eta1=25/100;//efficiency\n",
+"deltaT=20;//degree centigrade\n",
+"//T2dash=T2-20;//K\n",
+"//T1dash=T1;//K\n",
+"deltaEta1=30/100;\n",
+"Eta_dash=30/100;//efficiency\n",
+"//Eta1/Eta_dash=(1-T2dash/T1dash)/(1-T2/T1)\n",
+"//T1-T2=100;\n",
+"//0.75*T1-T2=0;\n",
+"A=[1 -1;0.75 -1];\n",
+"B=[100;0];\n",
+"X=A^-1*B;\n",
+"//Solution for T1 and T2 by matrix\n",
+"T1=X(1);//K\n",
+"T2=X(2);//K\n",
+"disp(T1,'Source temperature in K : ');\n",
+"disp(T2,'Sink temperature in K : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.6: Power_required_to_heat_pump.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.6\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"T1=23+273;//K\n",
+"COP_HP=2.5;\n",
+"HeatLost=60000;//KJ/hr\n",
+"HeatGenerated=4000;//KJ/hr\n",
+"Q1=HeatLost-HeatGenerated;//KJ/hr\n",
+"W=Q1/COP_HP;//KJ/hr\n",
+"W=W/3600;//KJ/s or KW\n",
+"disp(W,'Power input in KW : ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.7: Operation_in_which_engine_delivers_more_power.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.7\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',7);\n",
+"\n",
+"//Given Data :\n",
+"T1=400+273;//K\n",
+"T2=20+273;//K\n",
+"T3=100+273;//K\n",
+"T4=T2;//K\n",
+"Q1=12000;//KW\n",
+"Q3=25000;//KW\n",
+"Eta1=1-T2/T1;//Efficiency\n",
+"W1=Eta1*Q1;//KW\n",
+"disp(W1,'Power of Engine 1, W1 in KW : ');\n",
+"Eta2=1-T4/T3;//Efficiency\n",
+"W2=Eta2*Q3;//KW\n",
+"disp(W2,'Power of Engine 2, W2 in KW : ');\n",
+"disp('W1>W2, The engine 1 delivers more power.');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 3.8: Temperature_of_cold_space.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"//Exa 3.8\n",
+"clc;\n",
+"clear;\n",
+"close;\n",
+"format('v',6);\n",
+"\n",
+"//Given Data :\n",
+"Wdot=200;//W\n",
+"t1=40;//degree centigrade\n",
+"//Q2dot=20*(t1-t2);//W\n",
+"//COP=Q2dot/W2dot=T2/(T1-T2)\n",
+"//(t1-t2)/(W2dot/20)=(t1+273)/(t1-t2)\n",
+"//20*t1^2+20*t2^2-20*2*t1*t2-t1*Wdot-273*Wdot\n",
+"//(t2+273)/(t1-t2)=(t1-t2)/(Wdot/20)\n",
+"//t2^2-(2*t1+(Wdot/20))*t2-273*(Wdot/20)+t1^2\n",
+"P=[1 -(2*t1+(Wdot/20)) -273*(Wdot/20)+t1^2];\n",
+"t2=roots(P);\n",
+"t2=t2(2);//degree C\n",
+"//Taken only -ve value as t2 cant be greater than t1\n",
+"disp(t2,'Temperature of cold space(degree C)');"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}